From 5679960544eb2b2c5d66a43b6d95dfc61d9fe1d3 Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 13 Feb 2006 16:09:20 +0000 Subject: [PATCH] Work in progress: assignment of related concepts (children and parents) to concepts git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1071 fd906abe-77d9-0310-91a1-e0d9ade77398 --- README.txt | 3 +++ browser/concept.py | 22 ++-------------------- browser/concept_children.pt | 20 ++++++-------------- browser/configure.zcml | 7 +++++++ browser/node.js | 2 +- configure.zcml | 8 ++++++++ interfaces.py | 3 ++- target.py | 8 ++++---- 8 files changed, 33 insertions(+), 40 deletions(-) diff --git a/README.txt b/README.txt index 0a344cd..901651e 100755 --- a/README.txt +++ b/README.txt @@ -77,6 +77,9 @@ Concept Views >>> from loops.browser.concept import ConceptView >>> view = ConceptView(cc1, TestRequest()) + + >>> sorted([c.title for c in view.children()]) + [u'Zope 3'] Resources and what they have to do with Concepts diff --git a/browser/concept.py b/browser/concept.py index 585f6ad..31a0bb2 100644 --- a/browser/concept.py +++ b/browser/concept.py @@ -26,28 +26,10 @@ from zope.app import zapi from zope.app.dublincore.interfaces import ICMFDublinCore from zope.cachedescriptors.property import Lazy from zope.security.proxy import removeSecurityProxy +from loops.browser.common import BaseView -class ConceptView(object): - def __init__(self, context, request): - self.context = context - self.request = request - - @Lazy - def modified(self): - """ get date/time of last modification - """ - dc = ICMFDublinCore(self.context) - d = dc.modified or dc.created - return d and d.strftime('%Y-%m-%d %H:%M') or '' - - @Lazy - def url(self): - return zapi.absoluteURL(self.context, self.request) - - @Lazy - def title(self): - return self.context.title +class ConceptView(BaseView): def children(self): request = self.request diff --git a/browser/concept_children.pt b/browser/concept_children.pt index 2150aad..11811bf 100644 --- a/browser/concept_children.pt +++ b/browser/concept_children.pt @@ -1,25 +1,12 @@ + i18n:domain="loops">

Concept Title

-
- Sub-Concepts: - - **deleted** - - child - - - - -
Parent Concepts: -
+
+ Sub-Concepts: + +
diff --git a/browser/configure.zcml b/browser/configure.zcml index 8cef02b..a3c4ec6 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -28,6 +28,13 @@ permission="zope.View" /> + + + + + + diff --git a/interfaces.py b/interfaces.py index cebf9af..740423d 100644 --- a/interfaces.py +++ b/interfaces.py @@ -379,7 +379,8 @@ class ITargetRelation(IRelation): # the loops top-level container -class ILoops(ILoopsObject, IFolder): +#class ILoops(ILoopsObject, IFolder): +class ILoops(ILoopsObject): """ The top-level object of a loops site. """ contains(IConceptManager, IResourceManager, IViewManager) diff --git a/target.py b/target.py index ef28b5e..2c5147e 100644 --- a/target.py +++ b/target.py @@ -52,11 +52,11 @@ class ConceptProxy(object): def setTitle(self, title): self.target.title = title title = property(getTitle, setTitle) - def getSubConcepts(self, relationships=None): - return self.target.getSubConcepts(relationships) + def getChildren(self, relationships=None): + return self.target.getChildren(relationships) - def getParentConcepts(self, relationships=None): - return self.target.getParentConcepts(relationships) + def getParents(self, relationships=None): + return self.target.getParents(relationships) class ResourceProxy(object):