added package knowledge.glossary

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2178 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2007-11-14 12:32:22 +00:00
parent bee421bece
commit 9ad4c68809
7 changed files with 78 additions and 2 deletions

View file

@ -82,7 +82,7 @@ and follow the classifier step by step.
extractor: filename
>>> infoSet
{'filename': 'cust_im_contract_webbg_20071015.txt'}
{'filename': 'cust_im_contract_webbg_20071015'}
Let's now use the sample analyzer - an example that interprets very carefully
the underscore-separated parts of the filename.

View file

@ -53,7 +53,7 @@ class Classifier(AdapterBase):
_contextAttributes = list(IClassifier) + list(IConcept)
logLevel = 5
logLevel = 99 # 99 don't log; 5 minimal logging; 0 full logging
@Lazy
def conceptManager(self):

View file

@ -80,4 +80,8 @@
<zope:adapter factory="loops.knowledge.setup.SetupManager"
name="knowledge" />
<!-- sub-packages -->
<include package=".glossary" />
</configure>

4
knowledge/glossary/__init__.py Executable file
View file

@ -0,0 +1,4 @@
"""
$Id$
"""

37
knowledge/glossary/browser.py Executable file
View file

@ -0,0 +1,37 @@
"""
Demonstration view.
$Id$
"""
from zope.cachedescriptors.property import Lazy
from zope.app.pagetemplate import ViewPageTemplateFile
from loops.browser import common
from loops.browser.concept import ConceptRelationView
from loops.common import adapted
from loops import util
template = ViewPageTemplateFile('view_macros.pt')
conceptMacrosTemplate = common.conceptMacrosTemplate
class GlossaryItemView(common.BaseView):
@Lazy
def macro(self):
return template.macros['glossaryitem']
@Lazy
def conceptMacros(self):
return conceptMacrosTemplate.macros
@Lazy
def children(self):
rels = sorted(self.context.getChildRelations(),
key=(lambda x: x.second.title.lower()))
for r in rels:
yield ConceptRelationView(r, self.request, contextIsSecond=True)

View file

@ -0,0 +1,14 @@
<!-- $Id$ -->
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser"
i18n_domain="zope"
>
<page for="*"
name="glossaryitem.html"
class=".browser.GlossaryItemView"
permission="zope.View" />
</configure>

View file

@ -0,0 +1,17 @@
<!-- ZPT macros for demo view -->
<metal:block define-macro="glossaryitem">
<metal:title use-macro="item/conceptMacros/concepttitle" />
<div>siehe:
<span tal:repeat="related item/children">
<a href="#"
tal:content="related/title"
tal:attributes="href string:${view/url}/.target${related/uniqueId}">
Topic
</a><tal:comma condition="not:repeat/related/end">,</tal:comma>
</span>
</div>
</metal:block>