work-in-progress: loops.organize: type 'person' implemented
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1207 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
8bba484be0
commit
b79666d1b5
7 changed files with 123 additions and 4 deletions
|
@ -9,13 +9,13 @@
|
|||
|
||||
<div tal:define="items view/resources;
|
||||
action string:remove;
|
||||
qualifier string:parents;
|
||||
qualifier string:resources;
|
||||
summary string:Currently assigned resources;
|
||||
legend string:Resources;
|
||||
showPredicate string:yes;
|
||||
buttonText string:Remove Resources;"
|
||||
style="float:left; padding-right:20px">
|
||||
<metal:parents use-macro="views/relation_macros/listing" />
|
||||
<metal:resources use-macro="views/relation_macros/listing" />
|
||||
</div>
|
||||
|
||||
<div tal:define="legend string:Create Resource;
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
name="AddLoopsConcept.html"
|
||||
schema="loops.interfaces.IConcept"
|
||||
content_factory="loops.concept.Concept"
|
||||
fields="title"
|
||||
fields="title conceptType"
|
||||
template="add.pt"
|
||||
permission="zope.ManageContent"
|
||||
/>
|
||||
|
|
|
@ -306,7 +306,7 @@
|
|||
name="loops.PredicateSource"
|
||||
/>
|
||||
|
||||
<!-- Register various browser related components, including all views -->
|
||||
<include package=".organize" />
|
||||
<include package=".browser" />
|
||||
|
||||
</configure>
|
||||
|
|
4
organize/__init__.py
Normal file
4
organize/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
"""
|
||||
$Id$
|
||||
"""
|
||||
|
21
organize/configure.zcml
Normal file
21
organize/configure.zcml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!-- $Id$ -->
|
||||
|
||||
<configure
|
||||
xmlns:zope="http://namespaces.zope.org/zope"
|
||||
xmlns:browser="http://namespaces.zope.org/browser"
|
||||
i18n_domain="zope"
|
||||
>
|
||||
|
||||
<!-- adapters -->
|
||||
|
||||
<zope:adapter factory="loops.organize.party.Person"
|
||||
trusted="True" />
|
||||
|
||||
<zope:class class="loops.organize.party.Person">
|
||||
<require permission="zope.View"
|
||||
interface="cybertools.organize.interfaces.IPerson" />
|
||||
<require permission="zope.ManageContent"
|
||||
set_schema="cybertools.organize.interfaces.IPerson" />
|
||||
</zope:class>
|
||||
|
||||
</configure>
|
69
organize/party.py
Normal file
69
organize/party.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
"""
|
||||
Adapters for IConcept providing interfaces from the cybertools.organize package.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
from zope.app import zapi
|
||||
from zope.component import adapts
|
||||
from zope.interface import implements
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.security.proxy import removeSecurityProxy
|
||||
|
||||
from cybertools.organize.interfaces import IPerson
|
||||
from loops.interfaces import IConcept
|
||||
from loops.type import TypeInterfaceSourceList
|
||||
|
||||
|
||||
TypeInterfaceSourceList.typeInterfaces += (IPerson,)
|
||||
|
||||
|
||||
class Person(object):
|
||||
""" typeInterface adapter for concepts of type 'person'.
|
||||
"""
|
||||
|
||||
implements(IPerson)
|
||||
adapts(IConcept)
|
||||
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
self.__parent__ = context # to get the permission stuff right
|
||||
|
||||
def getFirstName(self):
|
||||
return getattr(self.context, '_firstName', u'')
|
||||
def setFirstName(self, firstName):
|
||||
self.context._firstName = firstName
|
||||
firstName = property(getFirstName, setFirstName)
|
||||
|
||||
def getLastName(self):
|
||||
return getattr(self.context, '_lastName', u'')
|
||||
def setLastName(self, lastName):
|
||||
self.context._lastName = lastName
|
||||
lastName = property(getLastName, setLastName)
|
||||
|
||||
def getBirthDate(self):
|
||||
return getattr(self.context, '_birthDate', u'')
|
||||
def setBirthDate(self, birthDate):
|
||||
self.context._birthDate = birthDate
|
||||
birthDate = property(getBirthDate, setBirthDate)
|
||||
|
||||
|
||||
|
25
organize/tests.py
Executable file
25
organize/tests.py
Executable file
|
@ -0,0 +1,25 @@
|
|||
# $Id$
|
||||
|
||||
import unittest, doctest
|
||||
from zope.testing.doctestunit import DocFileSuite
|
||||
from zope.app.testing import ztapi
|
||||
from zope.interface.verify import verifyClass
|
||||
from loops.organize.party import Person
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
"Basic tests for the organize sub-package."
|
||||
|
||||
def testSomethin(self):
|
||||
pass
|
||||
|
||||
|
||||
def test_suite():
|
||||
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
|
||||
return unittest.TestSuite((
|
||||
unittest.makeSuite(Test),
|
||||
#DocFileSuite('../README.txt', optionflags=flags),
|
||||
#DocFileSuite('../helpers.txt', optionflags=flags),
|
||||
))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(defaultTest='test_suite')
|
Loading…
Add table
Reference in a new issue