work in progress: relation package, configure.zcml
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@653 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
0751334025
commit
a170a210ce
5 changed files with 44 additions and 16 deletions
|
@ -6,5 +6,6 @@
|
|||
>
|
||||
|
||||
<include package=".browser" />
|
||||
<include package=".relation" />
|
||||
|
||||
</configure>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<!-- Register views and skin stuff -->
|
||||
<!--<include package=".browser" />-->
|
||||
|
||||
<tool
|
||||
<browser:tool
|
||||
interface="cybertools.menu.interfaces.IMenu"
|
||||
title="Menu"
|
||||
description="A Menu allows you to add menu items that are then shown in a portlet"
|
||||
|
@ -44,7 +44,7 @@
|
|||
<browser:addform
|
||||
label="Add Menu"
|
||||
name="AddMenu.html"
|
||||
schema="cybertools.interfaces.IMenu"
|
||||
schema="cybertools.menu.interfaces.IMenu"
|
||||
content_factory="cybertools.menu.Menu"
|
||||
fields="title"
|
||||
permission="zope.ManageContent"
|
||||
|
@ -60,8 +60,8 @@
|
|||
<browser:editform
|
||||
label="Edit Menu"
|
||||
name="edit.html"
|
||||
schema="cybertools.interfaces.IMenu"
|
||||
for="cybertools.interfaces.IMenu"
|
||||
schema="cybertools.menu.interfaces.IMenu"
|
||||
for="cybertools.menu.interfaces.IMenu"
|
||||
permission="zope.ManageContent"
|
||||
menu="zmi_views" title="Edit"
|
||||
fields="title"
|
||||
|
|
|
@ -65,7 +65,7 @@ It is also possible to remove a relation from the relation registry:
|
|||
>>> nyRels[0].first == kirk
|
||||
True
|
||||
|
||||
Triedic Relations
|
||||
Triadic Relations
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
We now extend our setting using a triadic relationship - triadic relations
|
||||
|
|
|
@ -2,17 +2,40 @@
|
|||
|
||||
<configure
|
||||
xmlns="http://namespaces.zope.org/zope"
|
||||
i18n_domain="zope"
|
||||
>
|
||||
xmlns:browser="http://namespaces.zope.org/browser"
|
||||
i18n_domain="zope">
|
||||
|
||||
<!-- Security definitions -->
|
||||
<localUtility class=".registry.RelationsRegistry">
|
||||
<require
|
||||
permission="zope.Public"
|
||||
interface=".interfaces.IRelationsRegistry"
|
||||
/>
|
||||
<require
|
||||
interface="zope.app.catalog.interfaces.ICatalogQuery"
|
||||
permission="zope.Public"
|
||||
/>
|
||||
<require
|
||||
interface="zope.app.catalog.interfaces.ICatalogEdit"
|
||||
permission="zope.ManageServices"
|
||||
/>
|
||||
<require
|
||||
interface="zope.app.container.interfaces.IContainer"
|
||||
permission="zope.ManageServices"
|
||||
/>
|
||||
<factory id="cybertools.relation.registry.RelationsRegistry" />
|
||||
</localUtility>
|
||||
|
||||
<!-- Content declarations -->
|
||||
<browser:tool
|
||||
interface=".interfaces.IRelationsRegistry"
|
||||
title="Relations Registry"
|
||||
description="Registry for relation objects."
|
||||
/>
|
||||
|
||||
<utility provides=".interfaces.IRelationsRegistry"
|
||||
factory=".utilities.RelationsRegistry" />
|
||||
|
||||
<!-- Register various browser related components, including all views -->
|
||||
<!--include package=".browser" /-->
|
||||
<browser:addMenuItem
|
||||
title="Relations Registry Utility"
|
||||
description="A utility that allows the registration of and query for relations"
|
||||
class=".registry.RelationsRegistry"
|
||||
permission="zope.ManageSite"
|
||||
/>
|
||||
|
||||
</configure>
|
||||
|
|
|
@ -69,14 +69,18 @@ class RelationsRegistry(Catalog):
|
|||
|
||||
implements(IRelationsRegistry)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
Catalog.__init__(self, *args, **kwargs)
|
||||
indexesSetUp = False
|
||||
|
||||
def setupIndexes(self):
|
||||
self['relationship'] = FieldIndex()
|
||||
self['first'] = FieldIndex()
|
||||
self['second'] = FieldIndex()
|
||||
self['third'] = FieldIndex()
|
||||
self.indexesSetUp = True
|
||||
|
||||
def register(self, relation):
|
||||
if not self.indexesSetUp:
|
||||
self.setupIndexes()
|
||||
relid = self._getUid(relation)
|
||||
for idx in self:
|
||||
index = self[idx]
|
||||
|
|
Loading…
Add table
Reference in a new issue