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=".browser" />
|
||||||
|
<include package=".relation" />
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<!-- Register views and skin stuff -->
|
<!-- Register views and skin stuff -->
|
||||||
<!--<include package=".browser" />-->
|
<!--<include package=".browser" />-->
|
||||||
|
|
||||||
<tool
|
<browser:tool
|
||||||
interface="cybertools.menu.interfaces.IMenu"
|
interface="cybertools.menu.interfaces.IMenu"
|
||||||
title="Menu"
|
title="Menu"
|
||||||
description="A Menu allows you to add menu items that are then shown in a portlet"
|
description="A Menu allows you to add menu items that are then shown in a portlet"
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<browser:addform
|
<browser:addform
|
||||||
label="Add Menu"
|
label="Add Menu"
|
||||||
name="AddMenu.html"
|
name="AddMenu.html"
|
||||||
schema="cybertools.interfaces.IMenu"
|
schema="cybertools.menu.interfaces.IMenu"
|
||||||
content_factory="cybertools.menu.Menu"
|
content_factory="cybertools.menu.Menu"
|
||||||
fields="title"
|
fields="title"
|
||||||
permission="zope.ManageContent"
|
permission="zope.ManageContent"
|
||||||
|
@ -60,8 +60,8 @@
|
||||||
<browser:editform
|
<browser:editform
|
||||||
label="Edit Menu"
|
label="Edit Menu"
|
||||||
name="edit.html"
|
name="edit.html"
|
||||||
schema="cybertools.interfaces.IMenu"
|
schema="cybertools.menu.interfaces.IMenu"
|
||||||
for="cybertools.interfaces.IMenu"
|
for="cybertools.menu.interfaces.IMenu"
|
||||||
permission="zope.ManageContent"
|
permission="zope.ManageContent"
|
||||||
menu="zmi_views" title="Edit"
|
menu="zmi_views" title="Edit"
|
||||||
fields="title"
|
fields="title"
|
||||||
|
|
|
@ -65,7 +65,7 @@ It is also possible to remove a relation from the relation registry:
|
||||||
>>> nyRels[0].first == kirk
|
>>> nyRels[0].first == kirk
|
||||||
True
|
True
|
||||||
|
|
||||||
Triedic Relations
|
Triadic Relations
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
We now extend our setting using a triadic relationship - triadic relations
|
We now extend our setting using a triadic relationship - triadic relations
|
||||||
|
|
|
@ -2,17 +2,40 @@
|
||||||
|
|
||||||
<configure
|
<configure
|
||||||
xmlns="http://namespaces.zope.org/zope"
|
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"
|
<browser:addMenuItem
|
||||||
factory=".utilities.RelationsRegistry" />
|
title="Relations Registry Utility"
|
||||||
|
description="A utility that allows the registration of and query for relations"
|
||||||
<!-- Register various browser related components, including all views -->
|
class=".registry.RelationsRegistry"
|
||||||
<!--include package=".browser" /-->
|
permission="zope.ManageSite"
|
||||||
|
/>
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
|
@ -69,14 +69,18 @@ class RelationsRegistry(Catalog):
|
||||||
|
|
||||||
implements(IRelationsRegistry)
|
implements(IRelationsRegistry)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
indexesSetUp = False
|
||||||
Catalog.__init__(self, *args, **kwargs)
|
|
||||||
|
def setupIndexes(self):
|
||||||
self['relationship'] = FieldIndex()
|
self['relationship'] = FieldIndex()
|
||||||
self['first'] = FieldIndex()
|
self['first'] = FieldIndex()
|
||||||
self['second'] = FieldIndex()
|
self['second'] = FieldIndex()
|
||||||
self['third'] = FieldIndex()
|
self['third'] = FieldIndex()
|
||||||
|
self.indexesSetUp = True
|
||||||
|
|
||||||
def register(self, relation):
|
def register(self, relation):
|
||||||
|
if not self.indexesSetUp:
|
||||||
|
self.setupIndexes()
|
||||||
relid = self._getUid(relation)
|
relid = self._getUid(relation)
|
||||||
for idx in self:
|
for idx in self:
|
||||||
index = self[idx]
|
index = self[idx]
|
||||||
|
|
Loading…
Add table
Reference in a new issue