Work in progress: Python3 fixes for loops.organize

This commit is contained in:
Helmut Merz 2024-09-25 17:05:57 +02:00
parent 509000a996
commit 04a9d9ced0
12 changed files with 109 additions and 252 deletions

View file

@ -1,29 +1,12 @@
# # loops.expert.browser.report
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ View classes for reporting.
View classes for reporting.
""" """
from logging import getLogger from logging import getLogger
from urllib import urlencode from urllib.parse import urlencode
from zope import interface, component from zope import interface, component
from zope.app.pagetemplate import ViewPageTemplateFile from zope.browserpage import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.traversing.api import getName, getParent from zope.traversing.api import getName, getParent

View file

@ -150,8 +150,8 @@ For testing, we first have to provide the needed utilities and settings
>>> auth = PrincipalRegistry() >>> auth = PrincipalRegistry()
>>> component.provideUtility(auth, IAuthentication) >>> component.provideUtility(auth, IAuthentication)
>>> from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility >>> from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
>>> from zope.app.principalannotation import PrincipalAnnotationUtility >>> from zope.principalannotation.utility import PrincipalAnnotationUtility
>>> principalAnnotations = PrincipalAnnotationUtility() >>> principalAnnotations = PrincipalAnnotationUtility()
>>> component.provideUtility(principalAnnotations, IPrincipalAnnotationUtility) >>> component.provideUtility(principalAnnotations, IPrincipalAnnotationUtility)

View file

@ -32,7 +32,7 @@ ZCML setup):
>>> from loops.concept import Concept >>> from loops.concept import Concept
>>> from loops.setup import addAndConfigureObject >>> from loops.setup import addAndConfigureObject
>>> johnC = addAndConfigureObject(concepts, Concept, 'john', title=u'John', >>> johnC = addAndConfigureObject(concepts, Concept, 'john', title='John',
... conceptType=person) ... conceptType=person)
@ -45,10 +45,10 @@ The classes used in this package are just adapters to IConcept.
>>> john = IPerson(johnC) >>> john = IPerson(johnC)
>>> john.title >>> john.title
u'John' 'John'
>>> john.firstName = u'John' >>> john.firstName = 'John'
>>> johnC._firstName >>> johnC._firstName
u'John' 'John'
>>> john.lastName is None >>> john.lastName is None
True True
>>> john.someOtherAttribute >>> john.someOtherAttribute
@ -76,7 +76,7 @@ For testing, we first have to provide the needed utilities and settings
>>> auth = setupData.auth >>> auth = setupData.auth
>>> principalAnnotations = setupData.principalAnnotations >>> principalAnnotations = setupData.principalAnnotations
>>> principal = auth.definePrincipal('users.john', u'John', login='john') >>> principal = auth.definePrincipal('users.john', 'John', login='john')
>>> john.userId = 'users.john' >>> john.userId = 'users.john'
>>> annotations = principalAnnotations.getAnnotationsById('users.john') >>> annotations = principalAnnotations.getAnnotationsById('users.john')
@ -86,7 +86,7 @@ For testing, we first have to provide the needed utilities and settings
Change a userId assignment: Change a userId assignment:
>>> principal = auth.definePrincipal('users.johnny', u'Johnny', login='johnny') >>> principal = auth.definePrincipal('users.johnny', 'Johnny', login='johnny')
>>> john.userId = 'users.johnny' >>> john.userId = 'users.johnny'
>>> annotations = principalAnnotations.getAnnotationsById('users.johnny') >>> annotations = principalAnnotations.getAnnotationsById('users.johnny')
@ -127,13 +127,13 @@ principal annotation:
If we try to assign a userId of a principal that already has a person If we try to assign a userId of a principal that already has a person
concept assigned we should get an error: concept assigned we should get an error:
>>> johnC = concepts['john'] = Concept(u'John') >>> johnC = concepts['john'] = Concept('John')
>>> johnC.conceptType = person >>> johnC.conceptType = person
>>> john = IPerson(johnC) >>> john = IPerson(johnC)
>>> john.userId = 'users.john' >>> john.userId = 'users.john'
>>> john.email = 'john@loopz.org' >>> john.email = 'john@loopz.org'
>>> marthaC = concepts['martha'] = Concept(u'Martha') >>> marthaC = concepts['martha'] = Concept('Martha')
>>> marthaC.conceptType = person >>> marthaC.conceptType = person
>>> martha = IPerson(marthaC) >>> martha = IPerson(marthaC)
@ -150,15 +150,15 @@ The member registration needs the whole pluggable authentication stuff
with a principal folder: with a principal folder:
>>> from zope.app.appsetup.bootstrap import ensureUtility >>> from zope.app.appsetup.bootstrap import ensureUtility
>>> from zope.app.authentication.authentication import PluggableAuthentication >>> from zope.pluggableauth import PluggableAuthentication
>>> from zope.app.security.interfaces import IAuthentication >>> from zope.authentication.interfaces import IAuthentication
>>> ensureUtility(site, IAuthentication, '', PluggableAuthentication, >>> ensureUtility(site, IAuthentication, '', PluggableAuthentication,
... copy_to_zlog=False) ... copy_to_zlog=False)
<...PluggableAuthentication...> <...PluggableAuthentication...>
>>> pau = component.getUtility(IAuthentication, context=site) >>> pau = component.getUtility(IAuthentication, context=site)
>>> from zope.app.authentication.principalfolder import PrincipalFolder >>> from zope.pluggableauth.plugins.principalfolder import PrincipalFolder
>>> from zope.app.authentication.interfaces import IAuthenticatorPlugin >>> from zope.pluggableauth.interfaces import IAuthenticatorPlugin
>>> pFolder = PrincipalFolder('loops.') >>> pFolder = PrincipalFolder('loops.')
>>> pau['loops'] = pFolder >>> pau['loops'] = pFolder
>>> pau.authenticatorPlugins = ('loops',) >>> pau.authenticatorPlugins = ('loops',)
@ -179,12 +179,12 @@ sure that a principal object can be served by a corresponding factory):
>>> from zope.app.authentication.principalfolder import FoundPrincipalFactory >>> from zope.app.authentication.principalfolder import FoundPrincipalFactory
>>> component.provideAdapter(FoundPrincipalFactory) >>> component.provideAdapter(FoundPrincipalFactory)
>>> data = {'loginName': u'newuser', >>> data = {'loginName': 'newuser',
... 'password': u'quack', ... 'password': 'quack',
... 'passwordConfirm': u'quack', ... 'passwordConfirm': 'quack',
... 'lastName': u'Sawyer', ... 'lastName': 'Sawyer',
... 'firstName': u'Tom', ... 'firstName': 'Tom',
... 'email': u'tommy@sawyer.com', ... 'email': 'tommy@sawyer.com',
... 'form.action': 'update',} ... 'form.action': 'update',}
and register it. and register it.
@ -200,19 +200,19 @@ and register it.
>>> person = concepts['person.newuser'] >>> person = concepts['person.newuser']
>>> pa = adapted(person) >>> pa = adapted(person)
>>> pa.lastName, pa.userId >>> pa.lastName, pa.userId
(u'Sawyer', u'loops.newuser') ('Sawyer', 'loops.newuser')
Now we can also retrieve it from the authentication utility: Now we can also retrieve it from the authentication utility:
>>> pau.getPrincipal('loops.newuser').title >>> pau.getPrincipal('loops.newuser').title
u'Tom Sawyer' 'Tom Sawyer'
Change Password Change Password
--------------- ---------------
>>> data = {'oldPassword': u'tiger', >>> data = {'oldPassword': 'tiger',
... 'password': u'lion', ... 'password': 'lion',
... 'passwordConfirm': u'lion', ... 'passwordConfirm': 'lion',
... 'action': 'update'} ... 'action': 'update'}
>>> request = TestRequest(form=data) >>> request = TestRequest(form=data)
@ -235,7 +235,7 @@ Invalidates the user account by generating a new password. A mail ist sent to
the email address of the person with a link for re-activating the account the email address of the person with a link for re-activating the account
and enter a new password. and enter a new password.
>>> data = {'loginName': u'dummy', >>> data = {'loginName': 'dummy',
... 'action': 'update'} ... 'action': 'update'}
>>> request = TestRequest(form=data) >>> request = TestRequest(form=data)
@ -257,14 +257,14 @@ store a persistent (internal) principal object.
>>> pau['persons'] = pbAuth >>> pau['persons'] = pbAuth
>>> pau.authenticatorPlugins = ('loops', 'persons',) >>> pau.authenticatorPlugins = ('loops', 'persons',)
>>> eddieC = addAndConfigureObject(concepts, Concept, 'eddie', title=u'Eddie', >>> eddieC = addAndConfigureObject(concepts, Concept, 'eddie', title='Eddie',
... conceptType=person) ... conceptType=person)
>>> eddie = adapted(eddieC) >>> eddie = adapted(eddieC)
>>> eddie.userId = 'persons.eddie' >>> eddie.userId = 'persons.eddie'
>>> pbAuth.setPassword('eddie', 'secret') >>> pbAuth.setPassword('eddie', 'secret')
>>> pbAuth.authenticateCredentials(dict(login='eddie', password='secret')) >>> pbAuth.authenticateCredentials(dict(login='eddie', password='secret'))
PrincipalInfo(u'persons.eddie') PrincipalInfo('persons.eddie')
Security Security
@ -275,7 +275,7 @@ Automatic security settings on persons
>>> from zope.traversing.api import getName >>> from zope.traversing.api import getName
>>> list(sorted(getName(c) for c in concepts['person'].getChildren())) >>> list(sorted(getName(c) for c in concepts['person'].getChildren()))
[u'jim', u'john', u'martha', u'person.newuser'] ['jim', 'john', 'martha', 'person.newuser']
Person objects that have a user assigned to them receive this user Person objects that have a user assigned to them receive this user
(principal) as their owner. (principal) as their owner.
@ -284,7 +284,7 @@ Person objects that have a user assigned to them receive this user
>>> IPrincipalRoleMap(concepts['john']).getPrincipalsAndRoles() >>> IPrincipalRoleMap(concepts['john']).getPrincipalsAndRoles()
[('loops.Person', 'users.john', PermissionSetting: Allow)] [('loops.Person', 'users.john', PermissionSetting: Allow)]
>>> IPrincipalRoleMap(concepts['person.newuser']).getPrincipalsAndRoles() >>> IPrincipalRoleMap(concepts['person.newuser']).getPrincipalsAndRoles()
[('loops.Person', u'loops.newuser', PermissionSetting: Allow)] [('loops.Person', 'loops.newuser', PermissionSetting: Allow)]
The person ``martha`` hasn't got a user id, so there is no role assigned The person ``martha`` hasn't got a user id, so there is no role assigned
to it. to it.
@ -299,7 +299,7 @@ We also need an interaction with a participation based on the principal
whose permissions we want to check. whose permissions we want to check.
>>> from zope.app.authentication.principalfolder import Principal >>> from zope.app.authentication.principalfolder import Principal
>>> pJohn = Principal('users.john', 'xxx', u'John') >>> pJohn = Principal('users.john', 'xxx', 'John')
>>> from loops.tests.auth import login >>> from loops.tests.auth import login
>>> login(pJohn) >>> login(pJohn)
@ -335,7 +335,7 @@ So let's try with another user with another role setting.
>>> principalRoles.assignRoleToPrincipal('loops.Staff', 'users.martha') >>> principalRoles.assignRoleToPrincipal('loops.Staff', 'users.martha')
>>> principalRoles.assignRoleToPrincipal('zope.Member', 'users.martha') >>> principalRoles.assignRoleToPrincipal('zope.Member', 'users.martha')
>>> pMartha = Principal('users.martha', 'xxx', u'Martha') >>> pMartha = Principal('users.martha', 'xxx', 'Martha')
>>> login(pMartha) >>> login(pMartha)
>>> canAccess(john, 'title') >>> canAccess(john, 'title')
@ -364,14 +364,14 @@ Task view with edit action
-------------------------- --------------------------
>>> from loops.organize.interfaces import ITask >>> from loops.organize.interfaces import ITask
>>> task = addAndConfigureObject(concepts, Concept, 'task', title=u'Task', >>> task = addAndConfigureObject(concepts, Concept, 'task', title='Task',
... conceptType=type, typeInterface=ITask) ... conceptType=type, typeInterface=ITask)
>>> from loops.organize.task import Task >>> from loops.organize.task import Task
>>> component.provideAdapter(Task) >>> component.provideAdapter(Task)
>>> task01 = addAndConfigureObject(concepts, Concept, 'task01', >>> task01 = addAndConfigureObject(concepts, Concept, 'task01',
... title=u'Task #1', conceptType=task) ... title='Task #1', conceptType=task)
>>> from loops.organize.browser.task import TaskView >>> from loops.organize.browser.task import TaskView
>>> view = TaskView(task01, TestRequest()) >>> view = TaskView(task01, TestRequest())
@ -389,21 +389,22 @@ but has to be entered as a type option.
Events listing Events listing
-------------- --------------
>>> event = addAndConfigureObject(concepts, Concept, 'event', title=u'Event', >>> event = addAndConfigureObject(concepts, Concept, 'event', title='Event',
... conceptType=type, typeInterface=ITask) ... conceptType=type, typeInterface=ITask)
>>> event01 = addAndConfigureObject(concepts, Concept, 'event01', >>> event01 = addAndConfigureObject(concepts, Concept, 'event01',
... title=u'Event #1', conceptType=event, ... title='Event #1', conceptType=event,
... ) ... )
>>> from loops.organize.browser.event import Events >>> from loops.organize.browser.event import Events
>>> events = addAndConfigureObject(concepts, Concept, 'events', title=u'Events', >>> events = addAndConfigureObject(concepts, Concept, 'events', title='Events',
... conceptType=concepts['query']) ... conceptType=concepts['query'])
>>> listing = Events(events, TestRequest()) >>> listing = Events(events, TestRequest())
>>> listing.getActions('portlet') >>> listing.getActions('portlet')
[<loops.browser.action.DialogAction ...>] [<loops.browser.action.DialogAction ...>]
>>> from loops.config.base import QueryOptions >>> from loops.config.base import QueryOptions
>>> component.provideAdapter(QueryOptions) >>> from cybertools.meta.interfaces import IOptions
>>> component.provideAdapter(QueryOptions, provides=IOptions)
>>> list(listing.events()) >>> list(listing.events())
[<loops.browser.concept.ConceptRelationView ...>] [<loops.browser.concept.ConceptRelationView ...>]
@ -422,12 +423,15 @@ Send Email to Members
>>> from loops.organize.browser.party import SendEmailForm >>> from loops.organize.browser.party import SendEmailForm
>>> form = SendEmailForm(menu, TestRequest()) >>> form = SendEmailForm(menu, TestRequest())
>>> form.members >>> form.members
[{'object': <...Person...>, 'email': 'john@loopz.org', 'title': u'John'}, [{'title': 'John', ...}, {'title': 'Tom Sawyer', ...}]
{'object': <...Person...>, 'email': u'tommy@sawyer.com', 'title': u'Tom Sawyer'}]
[{'object': <...Person...>, 'email': 'john@loopz.org', 'title': 'John'},
{'object': <...Person...>, 'email': 'tommy@sawyer.com', 'title': 'Tom Sawyer'}]
>>> form.subject >>> form.subject
u"loops Notification from '$site'" "loops Notification from '$site'"
>>> form.mailBody >>> form.mailBody
u'\n\nEvent #1\nhttp://127.0.0.1/loops/views/menu/.118\n\n' '\n\nEvent #1\nhttp://127.0.0.1/loops/views/menu/.118\n\n'
Show Presence of Other Users Show Presence of Other Users
@ -453,7 +457,7 @@ may be chosen from an arbitrary list.)
>>> from loops.organize.interfaces import IHasRole >>> from loops.organize.interfaces import IHasRole
>>> predicate = concepts['predicate'] >>> predicate = concepts['predicate']
>>> hasRole = addAndConfigureObject(concepts, Concept, 'hasrole', >>> hasRole = addAndConfigureObject(concepts, Concept, 'hasrole',
... title=u'has Role', ... title='has Role',
... conceptType=predicate, predicateInterface=IHasRole) ... conceptType=predicate, predicateInterface=IHasRole)
Let's now assign john to task01 and have a look at the relation created. Let's now assign john to task01 and have a look at the relation created.

View file

@ -1,36 +1,17 @@
# # loops.organize.auth
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ Specialized authentication components.
Specialized authentication components.
$Id$
""" """
from persistent import Persistent from persistent import Persistent
from zope.app.container.contained import Contained from zope.authentication.interfaces import IAuthentication
from zope.container.contained import Contained
from zope import component from zope import component
from zope.interface import Interface, implements from zope.interface import Interface, implementer
from zope.app.authentication.interfaces import IAuthenticatorPlugin from zope.pluggableauth.factories import PrincipalInfo
from zope.app.authentication.principalfolder import IInternalPrincipal from zope.pluggableauth.interfaces import IAuthenticatorPlugin
from zope.app.authentication.principalfolder import PrincipalInfo from zope.pluggableauth.plugins.principalfolder import IInternalPrincipal
from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
from zope.app.security.interfaces import IAuthentication
from zope import schema from zope import schema
from zope.traversing.api import getParent from zope.traversing.api import getParent
@ -52,15 +33,14 @@ class IPersonBasedAuthenticator(Interface):
readonly=True) readonly=True)
@implementer(IAuthenticatorPlugin, IPersonBasedAuthenticator)
class PersonBasedAuthenticator(Persistent, Contained): class PersonBasedAuthenticator(Persistent, Contained):
implements(IAuthenticatorPlugin, IPersonBasedAuthenticator)
passwordKey = 'loops.organize.password' passwordKey = 'loops.organize.password'
ignoreCase = True ignoreCase = True
def __init__(self, prefix=''): def __init__(self, prefix=''):
self.prefix = unicode(prefix) self.prefix = prefix
def authenticateCredentials(self, credentials): def authenticateCredentials(self, credentials):
if not isinstance(credentials, dict): if not isinstance(credentials, dict):

View file

@ -1,31 +1,14 @@
# # loops.organize.browser.event
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ Definition of view classes and other browser related stuff for tasks.
Definition of view classes and other browser related stuff for tasks.
""" """
import calendar import calendar
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from urllib import urlencode from urllib.parse import urlencode
from zope.app.container.interfaces import INameChooser from zope.browserpage import ViewPageTemplateFile
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.container.interfaces import INameChooser
from zope import interface, component from zope import interface, component
from zope.traversing.api import getName from zope.traversing.api import getName

View file

@ -1,36 +1,19 @@
# # loops.organize.browser.member
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ Definition of view classes and other browser related stuff for
Definition of view classes and other browser related stuff for
members (persons). members (persons).
""" """
from datetime import datetime from datetime import datetime
from email.MIMEText import MIMEText from email.mime.text import MIMEText
from zope import interface, component from zope import interface, component
from zope.app.authentication.principalfolder import InternalPrincipal from zope.app.authentication.principalfolder import InternalPrincipal
from zope.app.authentication.principalfolder import PrincipalInfo from zope.app.authentication.principalfolder import PrincipalInfo
from zope.app.form.browser.textwidgets import PasswordWidget as BasePasswordWidget from zope.app.form.browser.textwidgets import PasswordWidget as BasePasswordWidget
from zope.app.pagetemplate import ViewPageTemplateFile from zope.browserpage import ViewPageTemplateFile
from zope.app.principalannotation import annotations
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.i18nmessageid import MessageFactory from zope.i18nmessageid import MessageFactory
from zope.principalannotation.utility import annotations
from zope.security import checkPermission from zope.security import checkPermission
from zope.sendmail.interfaces import IMailDelivery from zope.sendmail.interfaces import IMailDelivery
from zope.traversing.browser import absoluteURL from zope.traversing.browser import absoluteURL
@ -249,7 +232,7 @@ class SecureMemberRegistration(BaseMemberRegistration, CreateForm):
result = regMan.register(login, pw, result = regMan.register(login, pw,
form.get('lastName'), form.get('firstName'), form.get('lastName'), form.get('firstName'),
email=email,) email=email,)
except ValueError, e: except ValueError:
fi = formState.fieldInstances['loginName'] fi = formState.fieldInstances['loginName']
fi.setError('duplicate_loginname', self.formErrors) fi.setError('duplicate_loginname', self.formErrors)
formState.severity = max(formState.severity, fi.severity) formState.severity = max(formState.severity, fi.severity)
@ -505,7 +488,7 @@ class FixPersonRoles(object):
for p in concepts['person'].getChildren([concepts['hasType']]): for p in concepts['person'].getChildren([concepts['hasType']]):
person = adapted(p) person = adapted(p)
userId = person.userId userId = person.userId
print '***', userId print('***', userId)
person.userId = userId person.userId = userId
return 'blubb' return 'blubb'

View file

@ -1,29 +1,12 @@
# # loops.organize.browser.party
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ Definition of view classes and other browser related stuff (e.g. actions) for
Definition of view classes and other browser related stuff (e.g. actions) for
loops.organize.party. loops.organize.party.
""" """
from email.MIMEText import MIMEText from email.mime.text import MIMEText
from zope import interface, component from zope import interface, component
from zope.app.pagetemplate import ViewPageTemplateFile from zope.browserpage import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.dublincore.interfaces import IZopeDublinCore from zope.dublincore.interfaces import IZopeDublinCore
from zope.sendmail.interfaces import IMailDelivery from zope.sendmail.interfaces import IMailDelivery

View file

@ -1,40 +1,22 @@
# # loops.organize.member
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ Member registration adapter(s).
Member registration adapter(s).
""" """
from zope import interface, component, schema from zope import interface, component, schema
from zope.app.component import queryNextUtility from zope.authentication.interfaces import IAuthentication, PrincipalLookupError
from zope.app.container.interfaces import INameChooser from zope.cachedescriptors.property import Lazy
from zope.component import adapts, queryNextUtility
from zope.container.interfaces import INameChooser
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from zope.component import adapts
from zope.interface import implements
from zope.app.authentication.interfaces import IPluggableAuthentication
from zope.app.authentication.interfaces import IAuthenticatorPlugin
from zope.app.authentication.principalfolder import IInternalPrincipal
from zope.app.authentication.principalfolder import InternalPrincipal
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
from zope.event import notify from zope.event import notify
from zope.i18nmessageid import MessageFactory from zope.i18nmessageid import MessageFactory
from zope.cachedescriptors.property import Lazy from zope.interface import implementer
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
from zope.pluggableauth.interfaces import IPluggableAuthentication
from zope.pluggableauth.interfaces import IAuthenticatorPlugin
from zope.pluggableauth.plugins.principalfolder import IInternalPrincipal
from zope.pluggableauth.plugins.principalfolder import InternalPrincipal
from cybertools.meta.interfaces import IOptions from cybertools.meta.interfaces import IOptions
from cybertools.typology.interfaces import IType from cybertools.typology.interfaces import IType
@ -49,9 +31,9 @@ from loops.type import getOptionsDict
from loops.util import _ from loops.util import _
@implementer(IMemberRegistrationManager)
class MemberRegistrationManager(object): class MemberRegistrationManager(object):
implements(IMemberRegistrationManager)
adapts(ILoops) adapts(ILoops)
person_typeName = 'person' person_typeName = 'person'

View file

@ -1,30 +1,11 @@
# # loops.organize.presence
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" """ Utility for collecting information about logged-in/active users.
Utility for collecting information about logged-in/active users.
Author: Hannes Plattner. Author: Hannes Plattner.
$Id$
""" """
from zope.interface import implements from zope.interface import implementer
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
from cybertools.meta.interfaces import IOptions from cybertools.meta.interfaces import IOptions
@ -34,10 +15,9 @@ from loops.organize.party import getPersonForUser
from loops.organize import util from loops.organize import util
@implementer(IPresence)
class Presence(object): class Presence(object):
implements(IPresence)
def __init__(self, min_until_logout=10, presentUsers=None): def __init__(self, min_until_logout=10, presentUsers=None):
self.min_until_logout = min_until_logout self.min_until_logout = min_until_logout
self.presentUsers = presentUsers or {} self.presentUsers = presentUsers or {}

View file

@ -1,29 +1,7 @@
# # loops.organize.setup
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
""" Automatic setup of a loops site for the organize package.
""" """
Automatic setup of a loops site for the organize package.
$Id$
"""
from zope.component import adapts
from zope.interface import implements, Interface
from loops.concept import Concept from loops.concept import Concept
from loops.interfaces import ITypeConcept from loops.interfaces import ITypeConcept

View file

@ -4,17 +4,17 @@ from zope.interface.verify import verifyClass
from zope import component from zope import component
from zope.app.appsetup.bootstrap import ensureUtility from zope.app.appsetup.bootstrap import ensureUtility
from zope.app.authentication.authentication import PluggableAuthentication from zope.authentication.interfaces import IAuthentication
from zope.app.authentication.interfaces import IAuthenticatorPlugin from zope.pluggableauth import PluggableAuthentication
from zope.app.authentication.principalfolder import FoundPrincipalFactory from zope.pluggableauth.interfaces import IAuthenticatorPlugin
from zope.app.authentication.principalfolder import InternalPrincipal from zope.pluggableauth.factories import FoundPrincipalFactory
from zope.app.authentication.principalfolder import Principal from zope.pluggableauth.factories import Principal
from zope.app.authentication.principalfolder import PrincipalFolder from zope.pluggableauth.plugins.principalfolder import InternalPrincipal
from zope.app.principalannotation import PrincipalAnnotationUtility from zope.pluggableauth.plugins.principalfolder import PrincipalFolder
from zope.app.principalannotation import annotations from zope.principalannotation.utility import PrincipalAnnotationUtility
from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility from zope.principalannotation.utility import annotations
from zope.app.security.interfaces import IAuthentication from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
from zope.app.security.principalregistry import PrincipalRegistry from zope.principalregistry.principalregistry import PrincipalRegistry
from zope.securitypolicy.interfaces import IRolePermissionManager from zope.securitypolicy.interfaces import IRolePermissionManager
from zope.securitypolicy.interfaces import IPrincipalRoleManager from zope.securitypolicy.interfaces import IPrincipalRoleManager

View file

@ -16,6 +16,7 @@ dependencies = [
"py-scopes", "py-scopes",
"markdown", "markdown",
"python-dotenv", "python-dotenv",
"zope.app.appsetup",
"zope.app.authentication", "zope.app.authentication",
"zope.app.exception", "zope.app.exception",
"zope.app.renderer", "zope.app.renderer",