--- a/mixins.py Fri May 21 15:02:56 2010 +0200
+++ b/mixins.py Fri May 21 15:04:29 2010 +0200
@@ -186,6 +186,21 @@
}
+# XXX move to cubicweb.web.views.treeview once we delete usage from this file
+def _done_init(done, view, row, col):
+ """handle an infinite recursion safety belt"""
+ if done is None:
+ done = set()
+ entity = view.cw_rset.get_entity(row, col)
+ if entity.eid in done:
+ msg = entity._cw._('loop in %(rel)s relation (%(eid)s)') % {
+ 'rel': entity.tree_attribute,
+ 'eid': entity.eid
+ }
+ return None, msg
+ done.add(entity.eid)
+ return done, entity
+
class TreeViewMixIn(object):
"""a recursive tree view"""
--- a/vregistry.py Fri May 21 15:02:56 2010 +0200
+++ b/vregistry.py Fri May 21 15:04:29 2010 +0200
@@ -45,7 +45,7 @@
from cubicweb import CW_SOFTWARE_ROOT
from cubicweb import RegistryNotFound, ObjectNotFound, NoSelectableObject
-from cubicweb.appobject import AppObject
+from cubicweb.appobject import AppObject, class_regid
def _toload_info(path, extrapath, _toload=None):
"""return a dictionary of <modname>: <modpath> and an ordered list of
@@ -84,16 +84,6 @@
"""returns a unique identifier for an appobject class"""
return '%s.%s' % (cls.__module__, cls.__name__)
-def class_regid(cls):
- """returns a unique identifier for an appobject class"""
- if 'id' in cls.__dict__:
- warn('[3.6] %s.%s: id is deprecated, use __regid__'
- % (cls.__module__, cls.__name__), DeprecationWarning)
- cls.__regid__ = cls.id
- if hasattr(cls, 'id') and not isinstance(cls.id, property):
- return cls.id
- return cls.__regid__
-
def class_registries(cls, registryname):
if registryname:
return (registryname,)
--- a/web/test/unittest_breadcrumbs.py Fri May 21 15:02:56 2010 +0200
+++ b/web/test/unittest_breadcrumbs.py Fri May 21 15:04:29 2010 +0200
@@ -15,8 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
+
from cubicweb.devtools.testlib import CubicWebTC
+
class BreadCrumbsTC(CubicWebTC):
def test_base(self):
--- a/web/views/editcontroller.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/editcontroller.py Fri May 21 15:04:29 2010 +0200
@@ -42,10 +42,10 @@
"""return (path, parameters) which should be used as redirect
information when this entity is being deleted
"""
- parent = self.cw_adapt_to('IBreadCrumbs').parent_entity()
+ parent = self.entity.cw_adapt_to('IBreadCrumbs').parent_entity()
if parent is not None:
return parent.rest_path(), {}
- return str(self.e_schema).lower(), {}
+ return str(self.entity.e_schema).lower(), {}
@implements_adapter_compat('IEditControl')
def pre_web_edit(self):
--- a/web/views/emailaddress.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/emailaddress.py Fri May 21 15:04:29 2010 +0200
@@ -144,4 +144,4 @@
__select__ = implements('EmailAddress')
def parent_entity(self):
- return self.email_of
+ return self.entity.email_of
--- a/web/views/ibreadcrumbs.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/ibreadcrumbs.py Fri May 21 15:04:29 2010 +0200
@@ -75,11 +75,12 @@
to displayed view (may be None). When recursing on a parent entity,
the `recurs` argument should be set to True.
"""
- path = [self.entity]
parent = self.parent_entity()
if parent is not None:
- adapter = ibreadcrumb_adapter(self.entity)
+ adapter = ibreadcrumb_adapter(parent)
path = adapter.breadcrumbs(view, True) + [self.entity]
+ else:
+ path = [self.entity]
if not recurs:
if view is None:
if 'vtitle' in self._cw.form:
--- a/web/views/isioc.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/isioc.py Fri May 21 15:04:29 2010 +0200
@@ -119,7 +119,7 @@
self.w(u'<dcterms:modified>%s</dcterms:modified>'
% entity.modification_date) # XXX format
self.w(u'<!-- FIXME : here be items -->')#entity.isioc_items()
- self.w(u'</sioc:%s>\n' % sioct)
+ self.w(u'</sioc:%s>\n' % isioct)
class SIOCItemView(EntityView):
@@ -156,5 +156,5 @@
self.w(u'</sioc:has_creator>\n')
self.w(u'<!-- FIXME : here be topics -->')#entity.isioc_topics()
self.w(u'<!-- FIXME : here be replies -->')#entity.isioc_replies()
- self.w(u' </sioc:%s>\n' % sioct)
+ self.w(u' </sioc:%s>\n' % isioct)
--- a/web/views/timetable.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/timetable.py Fri May 21 15:04:29 2010 +0200
@@ -93,7 +93,7 @@
visited_tasks = {} # holds a description of a task for a user
task_colors = {} # remember a color assigned to a task
- for date in date_range(date_min, date_max):
+ for date in date_range(date_min, date_max + ONEDAY):
columns = [date]
d_users = dates.get(date, {})
for user in users:
--- a/web/views/treeview.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/treeview.py Fri May 21 15:04:29 2010 +0200
@@ -28,6 +28,7 @@
from cubicweb.utils import make_uid
from cubicweb.selectors import implements, adaptable
from cubicweb.view import EntityView, EntityAdapter, implements_adapter_compat
+from cubicweb.mixins import _done_init
from cubicweb.web import json
from cubicweb.interfaces import ITree
from cubicweb.web.views import baseviews
@@ -186,21 +187,6 @@
return path
-def _done_init(done, view, row, col):
- """handle an infinite recursion safety belt"""
- if done is None:
- done = set()
- entity = view.cw_rset.get_entity(row, col)
- if entity.eid in done:
- msg = entity._cw._('loop in %(rel)s relation (%(eid)s)') % {
- 'rel': entity.tree_attribute,
- 'eid': entity.eid
- }
- return None, msg
- done.add(entity.eid)
- return done, entity
-
-
class BaseTreeView(baseviews.ListView):
"""base tree view"""
__regid__ = 'tree'
--- a/web/views/xmlrss.py Fri May 21 15:02:56 2010 +0200
+++ b/web/views/xmlrss.py Fri May 21 15:04:29 2010 +0200
@@ -128,7 +128,7 @@
@implements_adapter_compat('IFeed')
def rss_feed_url(self):
"""return an url to the rss feed for this entity"""
- return self.absolute_url(vid='rss')
+ return self.entity.absolute_url(vid='rss')
class RSSFeedURL(Component):