changeset 1329:4a8c4849d162

Got syncing working with pages that are just in one wiki.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Sat, 19 Aug 2006 16:06:52 +0200
parents f6801f7e4d59
children df88b475c1f0
files MoinMoin/_tests/test_wikisync.py MoinMoin/action/SyncPages.py MoinMoin/wikisync.py docs/CHANGES.aschremmer
diffstat 4 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikisync.py	Sat Aug 19 14:45:18 2006 +0200
+++ b/MoinMoin/_tests/test_wikisync.py	Sat Aug 19 16:06:52 2006 +0200
@@ -29,6 +29,7 @@
         self.assert_(not tags.get_all_tags())
         tags.add(remote_wiki="foo", remote_rev=1, current_rev=2, direction=BOTH, normalised_name="FrontPage")
         tags = TagStore(self.page) # reload
+        dummy = repr(tags.get_all_tags()) # this should not raise
         self.assert_(tags.get_all_tags()[0].remote_rev == 1)
     
     def tearDown(self):
--- a/MoinMoin/action/SyncPages.py	Sat Aug 19 14:45:18 2006 +0200
+++ b/MoinMoin/action/SyncPages.py	Sat Aug 19 16:06:52 2006 +0200
@@ -225,7 +225,7 @@
 
             matching_tags = tags.fetch(iwid_full=remote.iwid_full, direction=match_direction)
             matching_tags.sort()
-            #print "------ TAGS: " + repr(matching_tags) + repr(tags.tags)
+            # print "------ TAGS: " + repr(matching_tags) + repr(tags.tags) XXX
 
             # some default values for non matching tags
             normalised_name = None
@@ -296,7 +296,8 @@
             if rp.local_mime_type == MIMETYPE_MOIN:
                 new_contents_unicode = new_contents.decode("utf-8")
                 # here, the actual merge happens
-                # XXX print "Merging %r, %r and %r" % (old_contents.decode("utf-8"), new_contents, current_page.get_raw_body())
+                # XXX
+                # print "Merging %r, %r and %r" % (old_contents.decode("utf-8"), new_contents, current_page.get_raw_body())
                 verynewtext = diff3.text_merge(old_contents.decode("utf-8"), new_contents_unicode, current_page.get_raw_body(), 2, *conflict_markers)
                 verynewtext_raw = verynewtext.encode("utf-8")
             else:
@@ -306,7 +307,7 @@
                     verynewtext_raw = current_page.get_raw_body_str()
 
             diff = textdiff(new_contents, verynewtext_raw)
-            # XXX print "Diff against %r" % new_contents.encode("utf-8")
+            # print "Diff against %r" % new_contents.encode("utf-8") # XXX
 
             comment = u"Local Merge - %r" % (remote.get_interwiki_name() or remote.get_iwid())
 
--- a/MoinMoin/wikisync.py	Sat Aug 19 14:45:18 2006 +0200
+++ b/MoinMoin/wikisync.py	Sat Aug 19 16:06:52 2006 +0200
@@ -279,14 +279,14 @@
 
     def createSyncPage(self, page_name):
         normalised_name = normalise_pagename(page_name, self.prefix)
+        if normalised_name is None:
+            return None
         if not self.request.user.may.write(normalised_name):
             return None
-        if normalised_name is None:
-            return None
         page = Page(self.request, page_name)
         revno = page.get_real_rev()
         if revno == 99999999: # I love sane in-band signalling
-            revno = None
+            return None
         return SyncPage(normalised_name, local_rev=revno, local_name=page_name, local_deleted=not page.exists())
 
     # Public methods:
@@ -345,7 +345,7 @@
         self.normalised_name = normalised_name
 
     def __repr__(self):
-        return u"<Tag normalised_pagename=%r remote_wiki=%r remote_rev=%r current_rev=%r>" % (self.normalised_name, self.remote_wiki, self.remote_rev, self.current_rev)
+        return u"<Tag normalised_pagename=%r remote_wiki=%r remote_rev=%r current_rev=%r>" % (getattr(self, "normalised_name", "UNDEF"), self.remote_wiki, self.remote_rev, self.current_rev)
 
     def __cmp__(self, other):
         if not isinstance(other, Tag):
--- a/docs/CHANGES.aschremmer	Sat Aug 19 14:45:18 2006 +0200
+++ b/docs/CHANGES.aschremmer	Sat Aug 19 16:06:52 2006 +0200
@@ -15,6 +15,7 @@
 
     * Test with prefixes
     * Search for XXX
+    * Delete iters?
     * Maybe refactor YYY into MoinLocalWiki
     * Remove amount of "very" in the code
     * Clean up trailing whitespace.