diff MoinMoin/items/__init__.py @ 905:51475954290f storage-ng

rename all revno usages to revid (no numbers any more), remove update_item param todo: set meta and reduce revision script
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 30 Sep 2011 16:44:50 +0200
parents 46263060782e
children a31e0d2f542d
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Fri Sep 30 15:53:00 2011 +0200
+++ b/MoinMoin/items/__init__.py	Fri Sep 30 16:44:50 2011 +0200
@@ -167,7 +167,7 @@
         return cls(name, contenttype=unicode(contenttype), **kw)
 
     @classmethod
-    def create(cls, name=u'', contenttype=None, rev_no=CURRENT, item=None):
+    def create(cls, name=u'', contenttype=None, rev_id=CURRENT, item=None):
         if contenttype is None:
             contenttype = u'application/x-nonexistent'
 
@@ -184,7 +184,7 @@
         else:
             logging.debug("Got item: %r" % name)
             try:
-                rev = item.get_revision(rev_no)
+                rev = item.get_revision(rev_id)
                 contenttype = u'application/octet-stream' # it exists
             except KeyError: # NoSuchRevisionError:
                 try:
@@ -194,7 +194,7 @@
                     logging.debug("Item %r has no revisions." % name)
                     rev = DummyRev(item, contenttype)
                     logging.debug("Item %r, created dummy revision with contenttype %r" % (name, contenttype))
-            logging.debug("Got item %r, revision: %r" % (name, rev_no))
+            logging.debug("Got item %r, revision: %r" % (name, rev_id))
         contenttype = rev.meta.get(CONTENTTYPE) or contenttype # use contenttype in case our metadata does not provide CONTENTTYPE
         logging.debug("Item %r, got contenttype %r from revision meta" % (name, contenttype))
         #logging.debug("Item %r, rev meta dict: %r" % (name, dict(rev.meta)))
@@ -301,15 +301,15 @@
 
     def _do_modify_show_templates(self):
         # call this if the item is still empty
-        rev_nos = []
+        rev_ids = []
         item_templates = self.get_templates(self.contenttype)
         return render_template('modify_show_template_selection.html',
                                item_name=self.name,
                                rev=self.rev,
                                contenttype=self.contenttype,
                                templates=item_templates,
-                               first_rev_no=rev_nos and rev_nos[0],
-                               last_rev_no=rev_nos and rev_nos[-1],
+                               first_rev_id=rev_ids and rev_ids[0],
+                               last_rev_id=rev_ids and rev_ids[-1],
                                meta_rendered='',
                                data_rendered='',
                               )
@@ -463,11 +463,11 @@
         storage_item = backend[self.name]
         try:
             currentrev = storage_item.get_revision(CURRENT)
-            rev_no = currentrev.revid
+            rev_id = currentrev.revid
             contenttype_current = currentrev.meta.get(CONTENTTYPE)
         except KeyError: # XXX was: NoSuchRevisionError:
             currentrev = None
-            rev_no = None
+            rev_id = None
             contenttype_current = None
 
         meta = dict(meta) # we may get a read-only dict-like, copy it
@@ -519,7 +519,7 @@
 
         newrev = storage_item.store_revision(meta, data, overwrite=overwrite)
         item_modified.send(app._get_current_object(), item_name=name)
-        return None, None # XXX was: new_revno, size
+        return newrev.revid, newrev.meta[SIZE]
 
     def get_index(self):
         """ create an index of sub items of this item """