[Zope3-checkins] CVS: zopeproducts/demo/messageboard/step9/browser
- message.py:1.3 messageboard.py:1.3 thread.py:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Dec 15 00:33:40 EST 2003
Update of /cvs-repository/zopeproducts/demo/messageboard/step9/browser
In directory cvs.zope.org:/tmp/cvs-serv29788/browser
Modified Files:
message.py messageboard.py thread.py
Log Message:
Fixed step 9.
=== zopeproducts/demo/messageboard/step9/browser/message.py 1.2 => 1.3 ===
--- zopeproducts/demo/messageboard/step9/browser/message.py:1.2 Thu Aug 21 16:48:11 2003
+++ zopeproducts/demo/messageboard/step9/browser/message.py Mon Dec 15 00:33:09 2003
@@ -25,7 +25,7 @@
class MessageDetails:
def author(self):
- """Get user who last modified the Wiki Page."""
+ """Get user who last modified the message."""
creators = zapi.getAdapter(self.context, ICMFDublinCore).creators
if not creators:
return 'unknown'
@@ -62,7 +62,6 @@
IMailSubscriptions).addSubscriptions(emails)
elif 'REMOVE' in self.request:
emails = self.request['remails']
- print emails
if isinstance(emails, (str, unicode)):
emails = [emails]
zapi.getAdapter(self.context,
=== zopeproducts/demo/messageboard/step9/browser/messageboard.py 1.2 => 1.3 ===
--- zopeproducts/demo/messageboard/step9/browser/messageboard.py:1.2 Thu Aug 21 16:48:11 2003
+++ zopeproducts/demo/messageboard/step9/browser/messageboard.py Mon Dec 15 00:33:09 2003
@@ -16,6 +16,7 @@
$Id$
"""
import os
+from zope.app.interfaces.services.service import ISite
from zope.app.interfaces.services.registration import ActiveStatus
from zope.app.interfaces.workflow import IProcessInstanceContainer
from zope.app.interfaces.workflow import IProcessDefinitionImportExport
@@ -23,8 +24,7 @@
from zopeproducts.messageboard.interfaces import IMessage
from zope.app.browser.container.adding import Adding
-from zope.app.context import ContextWrapper
-from zope.app.services.service import ServiceManager, ServiceRegistration
+from zope.app.services.service import SiteManager, ServiceRegistration
from zope.app.services.servicenames import Workflows
from zope.app.traversing import getPath, getParent, traverse
from zope.app.workflow.service import WorkflowService
@@ -34,6 +34,7 @@
from zope.app.workflow.stateful.definition import \
StatefulProcessDefinition
from zope.component import getAdapter, queryAdapter, getView, getUtility
+from zope.proxy import removeAllProxies
class MessageBoardAdding(Adding):
@@ -48,28 +49,28 @@
content = super(AddMessageBoard, self).createAndAdd(data)
if self.request.get('workflow'):
- site = getParent(content)
- if not site.hasServiceManager():
- site.setServiceManager(ServiceManager())
- sm = traverse(site, '++etc++site')
- default = traverse(sm, 'default')
+ folder = removeAllProxies(getParent(content))
+ if not ISite.isImplementedBy(folder):
+ sm = SiteManager(folder)
+ folder.setSiteManager(sm)
+ sm = folder.getSiteManager()
+ default = sm['default']
rm = default.getRegistrationManager()
# Create Workflow Serivce
- default.setObject('MB-Workflows', WorkflowService())
- workflowservice = traverse(default, 'MB-Workflows')
+ default['MB-Workflows'] = WorkflowService()
+ workflowservice = default['MB-Workflows']
wf_path = "%s/%s" % (getPath(default), 'MB-Workflows')
- registration = ServiceRegistration(Workflows, wf_path, site)
- wf_id = rm.setObject('', registration)
+ registration = ServiceRegistration(Workflows, wf_path, folder)
+ wf_id = rm.addRegistration(registration)
rm[wf_id].status = ActiveStatus
# Create Default Processdefinition
- default.setObject('MB-WFProcesses',
- StatefulProcessDefinition())
- pd_path = getPath(traverse(default, 'MB-WFProcesses'))
+ default['MB-WFProcesses'] = StatefulProcessDefinition()
+ pd_path = getPath(default['MB-WFProcesses'])
registration = ProcessDefinitionRegistration(
- 'default', pd_path)
- pd_id = rm.setObject('', registration)
+ 'publish-message', pd_path)
+ pd_id = rm.addRegistration(registration)
traverse(rm, pd_id).status = ActiveStatus
# Import Default ProcessReview Workflow
@@ -81,8 +82,8 @@
default['MB-WFProcesses'], open(xml, mode='r'))
# Create Content Workflows Manager
- default.setObject('MB-WFContent', ContentWorkflowsManager())
- content = traverse(default, 'MB-WFContent')
+ default['MB-WFContent'] = ContentWorkflowsManager()
+ content = default['MB-WFContent']
content.subscribe()
content.register(IMessage, 'publish-message')
@@ -97,10 +98,9 @@
msgs = []
for name, msg in wrapped_pmsg.items():
if IMessage.isImplementedBy(msg):
- wrapped_msg = ContextWrapper(msg, wrapped_pmsg, name=name)
if hasMessageStatus(msg, 'pending'):
- msgs.append(ContextWrapper(msg, wrapped_msg, name=name))
- msgs += self.getPendingMessages(wrapped_msg)
+ msgs.append(msg)
+ msgs += self.getPendingMessages(msg)
return msgs
def getPendingMessagesInfo(self):
=== zopeproducts/demo/messageboard/step9/browser/thread.py 1.1 => 1.2 ===
--- zopeproducts/demo/messageboard/step9/browser/thread.py:1.1 Tue Jul 15 17:43:36 2003
+++ zopeproducts/demo/messageboard/step9/browser/thread.py Mon Dec 15 00:33:09 2003
@@ -17,7 +17,6 @@
"""
from messageboard import hasMessageStatus
from zopeproducts.messageboard.interfaces import IMessage
-from zope.app.context import ContextWrapper
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
class Thread:
@@ -32,12 +31,11 @@
for name, child in self.context.items():
if IMessage.isImplementedBy(child) and \
hasMessageStatus(child, 'published'):
- wrapped = ContextWrapper(child, self.context, name=name)
info = {}
info['title'] = child.title
url = self.base_url + name + '/'
info['url'] = url + '@@thread.html'
- thread = Thread(wrapped, self.request, url)
+ thread = Thread(child, self.request, url)
info['thread'] = thread.subthread()
children.append(info)
return children
More information about the Zope3-Checkins
mailing list