[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser - Find.py:1.1.2.5 browser.zcml:1.1.2.4 find.pt:1.1.2.3
Jim Fulton
jim@zope.com
Fri, 7 Jun 2002 10:41:38 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/OFS/Container/Find/Views/Browser
Modified Files:
Tag: Zope-3x-branch
Find.py browser.zcml find.pt
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals):
- RenameAllowToRequire
- GroupClassRelatedDirectivesInClassDirective
- ViewInterfaceAndSimplification
- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes
- TwoArgumentViewConstructors
- ImplementsInZCML
- SimpleViewCreationInZCML
- RemoveGetView
- ReplaceProtectWithAllow
- ViewMethodsAsViews
- MergeProtectionAndComponentDefinitions
There were also various security fixes resulting of better integration
of security with components.
=== Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser/Find.py 1.1.2.4 => 1.1.2.5 ===
"""
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
from Zope.App.PageTemplate import ViewPageTemplateFile
from Zope.App.OFS.Container.Find.IFind import IFind
# XXX this needs to be looked up in a registry
from Zope.App.OFS.Container.Find.FindAdapter import SimpleIdFindFilter
-from Zope.ComponentArchitecture import getAdapter, getRequestView
+from Zope.ComponentArchitecture import getAdapter, getView
-# XXX very simple implementation right now
-class Find(AttributePublisher):
-
- def __init__(self, context):
- self._context = context
+from Zope.Publisher.Browser.BrowserView import BrowserView
- def getContext(self):
- return self._context
+# XXX very simple implementation right now
+class Find(BrowserView):
index = ViewPageTemplateFile('find.pt')
-
- def setViewRequest(self, request):
- self._request = request
def findByIds(self, ids):
"""Do a find for the ids listed in ids, which is a string.
"""
- finder = getAdapter(self._context, IFind)
+ finder = getAdapter(self.context, IFind)
ids = ids.split()
# if we don't have any ids listed, don't search at all
if not ids:
return []
- request = self._request
+ request = self.request
result = []
for object in finder.find([SimpleIdFindFilter(ids)]):
id = getId(object)
- url = str(getRequestView(object, 'absolute_url', request))
+ url = str(getView(object, 'absolute_url', request))
result.append({ 'id': id, 'url': url})
return result
=== Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser/browser.zcml 1.1.2.3 => 1.1.2.4 ===
>
- <security:protectClass
- class=".Find."
- permission_id="Zope.ManageContent"
- names="index, findByIds" />
-
<browser:view
for="Zope.App.OFS.Container.IContainer.IReadContainer"
- name="find"
- factory=".Find." />
+ permission="Zope.ManageContent"
+ factory=".Find.">
+
+ <browser:page name="find.html" attribute="index" />
+ </browser:view>
</zopeConfigure>
=== Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser/find.pt 1.1.2.2 => 1.1.2.3 ===
<body>
<div metal:fill-slot="body" >
-<form action="." method="GET">
+<form action="./view::find.html" method="GET">
<input type="text" name="ids" value="" /><br />
<input type="submit" name="find_submit" value=" Find " />
</form>