additional view convenience methods

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2835 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-08-21 16:12:14 +00:00
parent f2eb384dd8
commit e7460d6799
3 changed files with 22 additions and 4 deletions

View file

@ -176,6 +176,14 @@ class BaseView(GenericView, I18NView):
def loopsRoot(self):
return self.context.getLoopsRoot()
@Lazy
def conceptManager(self):
return self.loopsRoot.getConceptManager()
@Lazy
def typePredicate(self):
return self.conceptManager.getTypePredicate()
@Lazy
def url(self):
return absoluteURL(self.context, self.request)

View file

@ -119,6 +119,13 @@ class BlogView(ConceptView):
if k != 'blogpost'])
return sorted(rels, key=lambda r: (r.order, r.title.lower()))
def isPersonalBlog(self):
tPerson = self.loopsRoot.getConceptManager()['person']
for p in self.context.getParents():
if p.conceptType == tPerson:
return True
return False
class BlogPostView(ConceptView):
@ -134,6 +141,11 @@ class BlogPostView(ConceptView):
data['privateComment'] = u''
return data
@Lazy
def description(self):
return self.renderText(self.context.description, 'text/restructured')
def getActions(self, category='object', page=None, target=None):
actions = []
if category == 'portlet' and self.editable:

View file

@ -21,8 +21,7 @@
<div class="description"
tal:define="description data/description"
tal:condition="description">
<span tal:content="structure python:
item.renderText(description, 'text/restructured')">Description</span></div>
<span tal:content="structure description">Description</span></div>
<div class="text"
tal:condition="nothing"
xtal:condition="python: repeat['related'].index() < 3">
@ -55,8 +54,7 @@
<div class="description"
tal:define="description description|item/description"
tal:condition="description">
<span tal:content="structure python:
item.renderText(description, 'text/restructured')">Description</span>
<span tal:content="structure description">Description</span>
</div>
<div class="text"
tal:content="structure item/render">Here comes the text...</div>