paula: removed old per-repo trunk subdirs
[paula.git] / paula.examples / src / paula / examples / content.py
blob7a9685964943b63b49f32b02fc3932c22b63dfb4
1 # Copyright (c) 2008 by Florian Friesdorf
3 # GNU Affero General Public License (AGPL)
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public
16 # License along with this program. If not, see
17 # <http://www.gnu.org/licenses/>.
18 """
19 """
20 __author__ = "Florian Friesdorf <flo@chaoflow.net>"
21 __docformat__ = "plaintext"
23 from persistent import Persistent
25 from zope.app.container.contained import Contained
26 from zope.component.factory import Factory
27 from zope.interface import implements
29 from paula.examples.interfaces import IBasicUser
30 from paula.examples.interfaces import IMinimalPloneUser
31 from paula.examples.interfaces import IMinimalPloneProperties
33 from paula.examples.interfaces import IBasicGroup
35 from paula.authutil.interfaces import IAuthProviderAdaptable
36 from paula.proputil.interfaces import IPropertyProviderAdaptable
37 from paula.grouputil.interfaces import IMembershipProviderAdaptable
40 class BasicUser(Persistent, Contained):
41 """A very basic user
43 >>> title = u'name'
44 >>> password = u'password'
46 >>> b = BasicUser(
47 ... title=title,
48 ... password=password,
49 ... )
50 >>> b.title == title
51 True
52 >>> b.password == password
53 True
54 """
55 implements(
56 IBasicUser,
57 IAuthProviderAdaptable,
60 title = u""
61 password = u""
63 def __init__(self, title=None, password=None):
64 self.title = title
65 self.password = password
68 class MinimalPloneUser(BasicUser):
69 """User content with minimal properties for plone
71 >>> title = u'name'
72 >>> password = u'password'
73 >>> realname = u'realname'
74 >>> email = u'email'
76 >>> b = MinimalPloneUser(
77 ... title=title,
78 ... password=password,
79 ... realname=realname,
80 ... email=email,
81 ... )
82 >>> b.realname == realname
83 True
84 >>> b.email == email
85 True
86 """
87 # it is important to explicitly provide IMinimalPloneProperties
88 # at least for our BasicPropertyProvider adapter
89 implements(
90 IMinimalPloneUser,
91 IMinimalPloneProperties,
92 IPropertyProviderAdaptable,
95 realname = u""
96 email = u""
98 def __init__(self,
99 title=None,
100 password=None,
101 realname=None,
102 email=None,
104 BasicUser.__init__(
105 self,
106 title=title,
107 password=password,
109 self.realname = realname
110 self.email = email
112 minimalPloneUserFactory = Factory(
113 MinimalPloneUser,
114 title=u"Create a minimal plone user",
115 description=u"This factory instantiates new minimal plone users",
119 class BasicGroup(Persistent, Contained):
122 implements(
123 IBasicGroup,
124 IMembershipProviderAdaptable,
127 title = u""
128 members = []
131 basicGroupFactory = Factory(
132 BasicGroup,
133 title=u"Create a basic group",
134 description=u"This factory instantiates new basic groups",