Skip to content
Snippets Groups Projects
Commit ea5822d2e6f4 authored by Laure Bourgois's avatar Laure Bourgois
Browse files

blog implements ISiocContainer, blogentry implements ISiocItem

parent aec47dd6493f
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,10 @@
__docformat__ = "restructuredtext en"
from cubicweb.entities import AnyEntity, fetch_config
from cubicweb.interfaces import ICalendarViews, ICalendarable
from cubicweb.interfaces import ICalendarViews, ICalendarable, ISiocItem, ISiocContainer
from logilab.mtconverter import html_escape
class BlogEntry(AnyEntity):
"""customized class for BlogEntry entities"""
id = 'BlogEntry'
fetch_attrs, fetch_order = fetch_config(['creation_date', 'title'], order='DESC')
......@@ -12,10 +12,10 @@
from logilab.mtconverter import html_escape
class BlogEntry(AnyEntity):
"""customized class for BlogEntry entities"""
id = 'BlogEntry'
fetch_attrs, fetch_order = fetch_config(['creation_date', 'title'], order='DESC')
__implements__ = (ICalendarViews, ICalendarable)
__implements__ = (ICalendarViews, ICalendarable, ISiocItem)
def dc_title(self):
return self.title
......@@ -44,9 +44,28 @@
descr = u'%s %s' % (_('posted on'), self.format_date(self.creation_date))
return descr
def isioc_item_creator(self):
return self.creator
def isioc_item_content(self):
return self.content
def isioc_item_container(self):
rset = self.related('entry_of')
entity = rset.get_entity(0, 0)
return entity
def isioc_item_get_reply(self):
pass
def isioc_item_creation_date(self):
return self.creation_date
def isioc_item_modification_date(self):
return self.modification_date
class Blog(AnyEntity):
"""customized class for Blog entities"""
id = 'Blog'
__rtags__ = {'entry_of': 'create'}
......@@ -47,9 +66,10 @@
class Blog(AnyEntity):
"""customized class for Blog entities"""
id = 'Blog'
__rtags__ = {'entry_of': 'create'}
__implements__ = AnyEntity.__implements__ + (ISiocContainer,)
def rss_feed_url(self):
......@@ -57,6 +77,19 @@
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())
def isioc_container_type(self):
return 'Weblog'
def isioc_container_creation_date(self):
return self.creation_date
def isioc_container_modification_date(self):
return self.modification_date
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