[Zope3-checkins] CVS: zopeproducts/zwiki/browser - wiki.py:1.4 wikipage.py:1.3
Stephan Richter
srichter@cbu.edu
Thu, 10 Apr 2003 08:50:42 -0400
Update of /cvs-repository/zopeproducts/zwiki/browser
In directory cvs.zope.org:/tmp/cvs-serv22600/browser
Modified Files:
wiki.py wikipage.py
Log Message:
Some changes that might fix an error.
=== zopeproducts/zwiki/browser/wiki.py 1.3 => 1.4 ===
--- zopeproducts/zwiki/browser/wiki.py:1.3 Thu Apr 10 07:31:39 2003
+++ zopeproducts/zwiki/browser/wiki.py Thu Apr 10 08:50:41 2003
@@ -15,10 +15,12 @@
$Id$
"""
+from datetime import datetime
from zope.component import \
getAdapter, getService, getServiceManager, createObject
from zope.proxy.context import ContextWrapper
from zope.proxy.introspection import removeAllProxies
+from zope.app.interfaces.dublincore import ICMFDublinCore
from zope.app.services.servicenames import HubIds
from zope.app.traversing import objectName, getPath
from zope.app.browser.container.adding import Adding
@@ -43,20 +45,26 @@
pkg = ContextWrapper(sm['default'], sm, name='default')
hub = ContextWrapper(pkg['HubIds-1'], sm, name='HubIds-1')
# Create, subscribe and add a Registration object.
- reg = Registration()
- pkg.setObject('WikiReg', reg)
- reg = ContextWrapper(reg, pkg, name='WikiReg')
- reg.subscribe()
+ if 'WikiReg' not in pkg:
+ reg = Registration()
+ pkg.setObject('WikiReg', reg)
+ reg = ContextWrapper(reg, pkg, name='WikiReg')
+ reg.subscribe()
# Create, subscribe and add an WikiTextIndex object
- index = WikiTextIndex()
- pkg.setObject('WikiTextIndex', index)
- index = ContextWrapper(index, pkg, name='WikiTextIndex')
- index.subscribe(hub, True)
+ if 'WikiTextIndex' not in pkg:
+ index = WikiTextIndex()
+ pkg.setObject('WikiTextIndex', index)
+ index = ContextWrapper(index, pkg, name='WikiTextIndex')
+ index.subscribe(hub, True)
if self.request.get('frontpage'):
page = removeAllProxies(createObject(None, 'WikiPage'))
page.type = u'Structured Text (STX)'
page.source = u'This is the FrontPage of the Wiki.'
+ dc = getAdapter(page, ICMFDublinCore)
+ dc.created = datetime.now()
+ dc.modified = datetime.now()
+ dc.creators = [u'wiki']
content.setObject('FrontPage', page)
return content
=== zopeproducts/zwiki/browser/wikipage.py 1.2 => 1.3 ===
--- zopeproducts/zwiki/browser/wikipage.py:1.2 Thu Apr 10 02:28:14 2003
+++ zopeproducts/zwiki/browser/wikipage.py Thu Apr 10 08:50:41 2003
@@ -73,6 +73,8 @@
date = getAdapter(self.context, ICMFDublinCore).modified
if date is None:
date = getAdapter(self.context, ICMFDublinCore).created
+ if date is None:
+ return ''
formatter = self.request.locale.getDateTimeFormatter('medium')
return formatter.format(date)