# HG changeset patch
# User Arthur Lutz <arthur.lutz@logilab.fr>
# Date 1260279280 -3600
#      Tue Dec 08 14:34:40 2009 +0100
# Node ID 13dc14ad5dda60a5950378ec5396e1831dbef73c
# Parent  83092ccf808b5bab38ddcd51300f77193c4d4eb6
last 3.6 api chanages - no more deprecation errors

diff --git a/entities.py b/entities.py
--- a/entities.py
+++ b/entities.py
@@ -16,7 +16,7 @@
 
 class Comment(TreeMixIn, AnyEntity):
     """customized class for Comment entities"""
-    id = 'Comment'
+    __regid__ = 'Comment'
     tree_attribute = 'comments'
     __implements__ = AnyEntity.__implements__ + (ITree,)
 
@@ -38,7 +38,7 @@
 
 
 class CommentFullTextView(EntityView):
-    id = 'fulltext'
+    __regid__ = 'fulltext'
     __select__ = implements('Comment')
 
     def cell_call(self, row, col, indentlevel=0, withauthor=True):
@@ -51,7 +51,7 @@
             _ = self._cw._
             author = e.created_by and e.created_by[0].login or _("Unknown author")
             head = u'%s%s - %s :' % (indentstr,
-                                     _('On %s') % self.format_date(e.creation_date, time=True),
+                                     _('On %s') %  self._cw.format_date(e.creation_date, time=True),
                                      _('%s wrote') % author)
             lines = [head]
         else:
@@ -65,7 +65,7 @@
 
 class CommentFullThreadText(CommentFullTextView):
     """display a comment and its parents"""
-    id = 'fullthreadtext'
+    __regid__ = 'fullthreadtext'
 
     def cell_call(self, row, col):
         e = self.cw_rset.get_entity(row,col)
@@ -86,7 +86,7 @@
 class CommentFullThreadDescText(CommentFullTextView):
     """same as fullthreadtext, but going from top level object to leaf comments
     """
-    id = 'fullthreadtext_descending'
+    __regid__ = 'fullthreadtext_descending'
 
     def cell_call(self, row, col, indentlevel=0):
         e = self.cw_rset.get_entity(row,col)
diff --git a/hooks.py b/hooks.py
--- a/hooks.py
+++ b/hooks.py
@@ -13,21 +13,21 @@
 
 class CommentAddedView(notification.NotificationView):
     """get notified from new comments"""
-    id = 'notif_after_add_relation_comments'
+    __regid__ = 'notif_after_add_relation_comments'
     __select__ = implements('Comment',)
     msgid_timestamp = False
 
     def subject(self):
-        root = self.entity(self.row, self.col).root()
-        return '%s %s %s' % (self.req._('new comment for'),
+        root = self.cw_rset.get_entity(self.cw_row, self.cw_col).root()
+        return '%s %s %s' % (self._cw._('new comment for'),
                              root.dc_type(),
                              root.dc_title())
 
     def cell_call(self, row, col=0, **kwargs):
         self.cw_row, self.cw_col = row, col
         try:
-            view = self.vreg['views'].select('fullthreadtext', self.req,
-                                             rset=self.rset, row=row, col=col)
+            view = self._cw.vreg['views'].select('fullthreadtext', self._cw,
+                                             rset=self.cw_rset, row=row, col=col)
         except RegistryException:
             return
         return view.render(row=row, col=col, w=self.w, **kwargs)
diff --git a/test/unittest_comment.py b/test/unittest_comment.py
--- a/test/unittest_comment.py
+++ b/test/unittest_comment.py
@@ -11,7 +11,7 @@
 class CommentTC(CubicWebTC):
     """Comment"""
     def test_schema(self):
-        self.assertEquals(self.schema['comments'].rproperty('Comment', 'BlogEntry', 'composite'),
+        self.assertEquals(self.schema['comments'].rdef('Comment', 'BlogEntry').composite,
                           'object')
 
     def setup_database(self):
diff --git a/views.py b/views.py
--- a/views.py
+++ b/views.py
@@ -30,8 +30,8 @@
 from cubicweb.web.views.basecontrollers import JSonController
 
 
-uicfg.autoform_section.tag_subject_of(('*', 'comments', '*'),  'generated')
-uicfg.autoform_section.tag_object_of(('*', 'comments', '*'), 'generated')
+uicfg.autoform_section.tag_subject_of(('*', 'comments', '*'), formtype='main', section='hidden')
+uicfg.autoform_section.tag_object_of(('*', 'comments', '*'), formtype='main', section='hidden')
 uicfg.actionbox_appearsin_addmenu.tag_subject_of(('*', 'comments', '*'),  False)
 uicfg.actionbox_appearsin_addmenu.tag_object_of(('*', 'comments', '*'), False)
 uicfg.primaryview_section.tag_subject_of(('*', 'comments', '*'),  'hidden')
@@ -106,7 +106,7 @@
 
 
 class CommentTreeItemView(baseviews.ListItemView):
-    id = 'treeitem'
+    __regid__ = 'treeitem'
     __select__ = implements('Comment')
 
     def cell_call(self, row, col, **kwargs):
@@ -173,7 +173,7 @@
 # comment edition views #######################################################
 
 class InlineCommentView(EntityView):
-    id = 'inlinecomment'
+    __regid__ = 'inlinecomment'
     __select__ = yes() # explicit call when it makes sense
 
     def cell_call(self, row, col):
@@ -182,7 +182,7 @@
 
 
 class InlineEditCommentForm(FormViewMixIn, EntityView):
-    id = 'editcomment'
+    __regid__ = 'editcomment'
     __select__ = implements('Comment')
 
     jsfunc = "processComment(%s, '%s')"
@@ -211,7 +211,7 @@
 
 
 class InlineCommentForm(InlineEditCommentForm):
-    id = 'inlinecommentform'
+    __regid__ = 'inlinecommentform'
     __select__ = match_kwargs('commented') # explicit call when it makes sense
 
     jsonmeth = 'add_comment'
@@ -229,7 +229,7 @@
     """a component to display a <div> html section including comments
     related to an object
     """
-    id = 'commentsection'
+    __regid__ = 'commentsection'
     __select__ = (EntityVComponent.__select__
                   & relation_possible('comments', 'object', 'Comment'))
 
@@ -272,7 +272,7 @@
 # comment actions #############################################################
 
 class ReplyCommentAction(LinkToEntityAction):
-    id = 'reply_comment'
+    __regid__ = 'reply_comment'
     __select__ = LinkToEntityAction.__select__ & implements('Comment')
 
     etype = 'Comment'
@@ -294,7 +294,7 @@
 
 class AddCommentAction(LinkToEntityAction):
     """add comment is like reply for everything but Comment"""
-    id = 'reply_comment'
+    __regid__ = 'reply_comment'
     __select__ = LinkToEntityAction.__select__ & but_etype('Comment')
 
     etype = 'Comment'
@@ -307,7 +307,7 @@
 
 
 class EditCommentAction(Action):
-    id = 'edit_comment'
+    __regid__ = 'edit_comment'
     __select__ = one_line_rset() & implements('Comment') & has_permission('update')
 
     title = _('edit comment')
@@ -318,7 +318,7 @@
         return self.build_url(rql=self.rset.printable_rql(), vid='edition')
 
 class DeleteCommentAction(Action):
-    id = 'delete_comment'
+    __regid__ = 'delete_comment'
     __select__ = implements('Comment') & \
                  authenticated_user() & \
                  score_entity(lambda x: not x.reverse_comments and x.has_perm('delete'))