Skip to content
Snippets Groups Projects
Commit d6f708a74260 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

cleanup, blog entry breadcrumbs

parent 3e708b97e867
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,32 @@
from cubicweb.utils import todate
from cubicweb.entities import AnyEntity, fetch_config
from cubicweb.interfaces import ICalendarViews, ICalendarable, ISiocItem, ISiocContainer
from cubicweb.interfaces import (ICalendarViews, ICalendarable,
ISiocItem, ISiocContainer)
class Blog(AnyEntity):
"""customized class for Blog entities"""
id = 'Blog'
__implements__ = AnyEntity.__implements__ + (ISiocContainer,)
def rss_feed_url(self):
if self.rss_url:
return self.rss_url
rql = ('Any E ORDERBY D DESC '
'WHERE E is BlogEntry, E entry_of X, X eid %s, E creation_date D'
return self.build_url(rql=rql % self.eid, vid='rss',
vtitle=self.dc_title())
# isioc interface ##########################################################
def isioc_type(self):
return 'Weblog'
def isioc_items(self):
return self.reverse_entry_of
class BlogEntry(AnyEntity):
"""customized class for BlogEntry entities"""
......@@ -24,7 +49,11 @@
def dc_description(self, format='text/plain'):
return self.printable_value('content', format=format)
## calendar interfaces ####################################################
def parent(self):
return self.entry_of and self.entry_of[0] or None
# calendar interfaces ######################################################
@property
def start(self):
return self.creation_date
......@@ -48,8 +77,9 @@
descr = u'%s %s' % (_('posted on'), self.format_date(self.creation_date))
return descr
# isioc interface
# isioc interface ##########################################################
def isioc_content(self):
return self.content
def isioc_container(self):
......@@ -52,12 +82,10 @@
def isioc_content(self):
return self.content
def isioc_container(self):
rset = self.related('entry_of')
entity = rset.get_entity(0, 0)
return entity
return self.parent()
def isioc_type(self):
return 'BlogPost'
def isioc_replies(self):
......@@ -59,8 +87,9 @@
def isioc_type(self):
return 'BlogPost'
def isioc_replies(self):
# XXX link to comments
return []
def isioc_topics(self):
......@@ -64,4 +93,5 @@
return []
def isioc_topics(self):
# XXX link to tags, folders?
return []
......@@ -67,23 +97,1 @@
return []
class Blog(AnyEntity):
"""customized class for Blog entities"""
id = 'Blog'
__implements__ = AnyEntity.__implements__ + (ISiocContainer,)
def rss_feed_url(self):
if self.rss_url:
return self.rss_url
rql = 'Any E ORDERBY D DESC WHERE E is BlogEntry, E entry_of X, X eid %s, E creation_date D' % self.eid
return self.build_url(rql=rql, vid='rss', vtitle=self.dc_title())
# isioc interface
def isioc_type(self):
return 'Weblog'
def isioc_items(self):
return self.reverse_entry_of
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment