[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - module.py:1.4.36.1
Fred L. Drake, Jr.
fred@zope.com
Sat, 28 Jun 2003 10:44:34 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv6318/src/zope/app/browser/services
Modified Files:
Tag: fdrake-local-modules-branch
module.py
Log Message:
Checkpoint: changes to local modules started with Jim on Thursday.
These are not yet ready to land on the trunk.
=== Zope3/src/zope/app/browser/services/module.py 1.4 => 1.4.36.1 ===
--- Zope3/src/zope/app/browser/services/module.py:1.4 Mon Dec 30 16:28:20 2002
+++ Zope3/src/zope/app/browser/services/module.py Sat Jun 28 10:44:03 2003
@@ -21,12 +21,18 @@
from zope.component import getAdapter
from zope.publisher.browser import BrowserView
+from zope.app.i18n import ZopeMessageIDFactory as _
+
+
class AddModule(BrowserView):
- def action(self, name, source):
- mgr = Manager()
- mgr = self.context.add(mgr)
- mgr.new(name, source)
+ def action(self, source):
+ name = self.context.contentName
+ if not name:
+ raise UserError(_(u"module name must be provided"))
+ mgr = Manager(name, source)
+ mgr = self.context.add(mgr) # local registration
+ mgr.execute()
# For better or worse, the name Zope uses to manage a module
# can be different than the name Python code uses to import
# the module. Set the title metadata of the Zope module to
@@ -39,7 +45,8 @@
def update(self):
if "source" in self.request:
- self.context.update(self.request["source"])
- return u"The source was updated."
+ self.context.source = self.request["source"]
+ self.context.execute()
+ return _(u"The source was updated.")
else:
return u""