[CMF-checkins] CVS: CMF - CMFWikiPage.py:1.6

Ken Manheimer klm@digicool.com
Sat, 26 May 2001 19:09:45 -0400 (EDT)


Update of /cvs-repository/Packages/Products/CMFWiki
In directory korak.digicool.com:/tmp/cvs-serv27214

Modified Files:
	CMFWikiPage.py 
Log Message:
With these changes i can now easily convert existing WikiForNow wikis
to CMFWikis - i'll check in the script to do that momentarily.

.__init__(), makeCMFWikiPage(): Cleaned up argument names, and
rectified so we actually get the initial content passed to
DTMLDocument.__init__() properly.

addCMFWikiFolder(): Attribute FrontPage as SandBox page parent (a
bit of a kludge, but it's ok to have one special case out of two
cases, ay?)

Added some stray attributes to the official properties:

 ._subowner (plus, itemizing SUBOWNER_TYPES so we can have a select
            list on the properties page)
 .comment_number

This makes it easy to automate copying all the properties when
migrating old WikiForNow ZWiki Pages.
 



--- Updated File CMFWikiPage.py in package CMF --
--- CMFWikiPage.py	2001/05/26 17:57:46	1.5
+++ CMFWikiPage.py	2001/05/26 23:09:44	1.6
@@ -52,6 +52,9 @@
     comment_number = 0
     _st_data = None
     security = ClassSecurityInfo()
+    _subowner = 'both'
+    SUBOWNER_TYPES = ['creator', 'original_owner', 'both']
+
     ZWIKI_PAGE_TYPES = ['structuredtext', 'plaintext', 'html',
                         'structuredtextdtml', 'htmldtml',
                         'classicwiki']
@@ -92,6 +95,9 @@
                  {'id':'dtml_allowed', 'type': 'boolean', 'mode': 'w'},
                  {'id':'last_editor', 'type': 'string', 'mode': 'w'},
                  {'id':'last_log', 'type': 'string', 'mode': 'w'},
+                 {'id':'comment_number', 'type': 'int', 'mode': 'w'},
+                 {'id':'_subowner', 'mode': 'w', 'type': 'selection',
+                  'select_variable': 'SUBOWNER_TYPES'},
                  )
     # permission defaults
     set = security.setPermissionDefault
@@ -103,11 +109,10 @@
     set(CMFWikiPermissions.Comment, ('Owner', 'Manager', 'Authenticated'))
     set = None
 
-    def __init__(self, file=None, __name__='', source_string='', mapping=None):
-        DTMLDocument.__init__(self, file=file,
+    def __init__(self, __name__='', source_string='', mapping=None):
+        DTMLDocument.__init__(self, source_string=source_string,
                               mapping=mapping,
-                              __name__=__name__,
-                              source_string=source_string)
+                              __name__=__name__)
         DefaultDublinCoreImpl.__init__(self)
 
     security.declarePublic('getId')
@@ -1813,7 +1818,7 @@
             return makeCMFWikiPage(name, '', body)
 
 def makeCMFWikiPage(id, title, file):
-    ob = CMFWikiPage(file, __name__=id)
+    ob = CMFWikiPage(source_string=file, __name__=id)
     ob.title = title
     ob.parents = []
     username = getSecurityManager().getUser().getUserName()
@@ -1849,3 +1854,6 @@
         addCMFWikiPage(ob, fname, title='', file=f.read())
         page = getattr(ob, fname)
         page.indexObject()
+        # Hack - may be ok if we continue to have, like, only two pages:
+        if fname == 'SandBox':
+            page.parents = ['FrontPage']