[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/module -
browse_module.pt:1.1 __init__.py:1.5 configure.zcml:1.5
K.Narasimha Murthy
nmurthy at zeomega.com
Wed Dec 17 04:15:42 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/services/module
In directory cvs.zope.org:/tmp/cvs-serv20667
Modified Files:
__init__.py configure.zcml
Added Files:
browse_module.pt
Log Message:
Provided Browse view for service module, added new method for browse view, added browse_module.pt and changed configure.zcml to support brose view.
=== Added File Zope3/src/zope/app/browser/services/module/browse_module.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title metal:fill-slot="title" i18n:translate="">View Module Names</title>
</head>
<body>
<div metal:fill-slot="body">
<table class="listingdescription" summary="Module Listing"
cellspacing="0" >
<thead>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</thead>
<tal:repeat tal:repeat="dict view/getModuleName">
<tr tal:define="oddrow repeat/dict/odd;"
tal:attributes="class python:oddrow and 'even' or 'odd'">
<td tal:content="dict/name">An name</td>
<td tal:content="dict/objtype">Type</td>
<td tal:content="dict/doc">DocString</td>
</tr>
</tal:repeat>
</table>
</div>
</body>
</html>
=== Zope3/src/zope/app/browser/services/module/__init__.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/module/__init__.py:1.4 Thu Aug 21 17:57:41 2003
+++ Zope3/src/zope/app/browser/services/module/__init__.py Wed Dec 17 04:15:41 2003
@@ -20,6 +20,7 @@
from zope.app.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.publisher.browser import BrowserView
+from zope.proxy import removeAllProxies
from zope.app.i18n import ZopeMessageIDFactory as _
@@ -45,3 +46,25 @@
return _(u"The source was updated.")
else:
return u""
+
+class ViewModule(BrowserView):
+
+ def getModuleName(self):
+ module = removeAllProxies(self.context.getModule())
+ remove_keys = ['__name__', '__builtins__', '_p_serial']
+
+ L = [(getattr(obj, '__name__', id),
+ getattr(obj, '__doc__', ''),
+ type(obj).__name__
+ )
+ for id, obj in module.__dict__.items()
+ if id not in remove_keys]
+ L.sort()
+
+ l_dict = [{"name": name, "doc": doc, "objtype": objtype} for name, doc, objtype in L]
+
+ for dic in l_dict:
+ if dic['objtype'].find('Class') != -1: dic['objtype'] = 'Class'
+ if dic['objtype'].find('Function') != -1: dic['objtype'] = 'Function'
+ return l_dict
+
\ No newline at end of file
=== Zope3/src/zope/app/browser/services/module/configure.zcml 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/module/configure.zcml:1.4 Mon Aug 25 15:28:39 2003
+++ Zope3/src/zope/app/browser/services/module/configure.zcml Wed Dec 17 04:15:41 2003
@@ -23,6 +23,15 @@
<page name="index.html" template="add_module.pt" />
<page name="action.html" attribute="action" />
</view>
+
+ <page
+ name="browse.html"
+ for="zope.app.interfaces.services.module.IModuleManager"
+ menu="zmi_views" title="Browse"
+ permission="zope.ManageServices"
+ class="zope.app.browser.services.module.ViewModule"
+ template="browse_module.pt"
+ />
<menuItem
menu="add_component"
More information about the Zope3-Checkins
mailing list