[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - module.py:1.4
Jeremy Hylton
jeremy@zope.com
Mon, 30 Dec 2002 16:28:20 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv19888
Modified Files:
module.py
Log Message:
Assign module's metadata when it is created.
=== Zope3/src/zope/app/browser/services/module.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/module.py:1.3 Mon Dec 30 16:09:04 2002
+++ Zope3/src/zope/app/browser/services/module.py Mon Dec 30 16:28:20 2002
@@ -16,8 +16,10 @@
$Id$
"""
-from zope.publisher.browser import BrowserView
+from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.services.module import Manager
+from zope.component import getAdapter
+from zope.publisher.browser import BrowserView
class AddModule(BrowserView):
@@ -25,6 +27,12 @@
mgr = Manager()
mgr = self.context.add(mgr)
mgr.new(name, source)
+ # 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
+ # the real name.
+ dc = getAdapter(mgr, IZopeDublinCore)
+ dc.title = name
self.request.response.redirect(self.context.nextURL())
class EditModule(BrowserView):