[Checkins] SVN: zope.app.security/trunk/ Use template instead of building html code in python for AuthUtilitySearchView.
Dan Korostelev
nadako at gmail.com
Sun Feb 15 18:57:56 EST 2009
Log message for revision 96575:
Use template instead of building html code in python for AuthUtilitySearchView.
Changed:
U zope.app.security/trunk/CHANGES.txt
U zope.app.security/trunk/setup.py
U zope.app.security/trunk/src/zope/app/security/browser/auth.py
A zope.app.security/trunk/src/zope/app/security/browser/authutilitysearchview.pt
-=-
Modified: zope.app.security/trunk/CHANGES.txt
===================================================================
--- zope.app.security/trunk/CHANGES.txt 2009-02-15 22:55:12 UTC (rev 96574)
+++ zope.app.security/trunk/CHANGES.txt 2009-02-15 23:57:55 UTC (rev 96575)
@@ -2,6 +2,12 @@
CHANGES
=======
+3.6.1 (unreleased)
+------------------
+
+- Use template for AuthUtilitySearchView instead of ugly HTML
+ constructing in the python code.
+
3.6.0 (2009-01-31)
------------------
Modified: zope.app.security/trunk/setup.py
===================================================================
--- zope.app.security/trunk/setup.py 2009-02-15 22:55:12 UTC (rev 96574)
+++ zope.app.security/trunk/setup.py 2009-02-15 23:57:55 UTC (rev 96575)
@@ -22,7 +22,7 @@
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(name='zope.app.security',
- version = '3.6.0dev',
+ version = '3.6.1dev',
author='Zope Corporation and Contributors',
author_email='zope-dev at zope.org',
description='Security Components for Zope 3 Applications',
Modified: zope.app.security/trunk/src/zope/app/security/browser/auth.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/browser/auth.py 2009-02-15 22:55:12 UTC (rev 96574)
+++ zope.app.security/trunk/src/zope/app/security/browser/auth.py 2009-02-15 23:57:55 UTC (rev 96575)
@@ -27,46 +27,18 @@
from zope.app.pagetemplate import ViewPageTemplateFile
-search_label = _('search-button', 'Search')
-search_title = _('Search String')
-
class AuthUtilitySearchView(object):
- __used_for__ = IAuthentication
+ template = ViewPageTemplateFile('authutilitysearchview.pt')
+ searchTitle = u'principals.zcml'
def __init__(self, context, request):
self.context = context
self.request = request
def render(self, name):
- sourcename = 'principals.zcml'
- html = []
+ return self.template(title=self.searchTitle, name=name)
- # add sub title for source search field
- html.append('<h4>%s</h4>' % sourcename)
- # start row for search fields
- html.append('<div class="row">')
- html.append('<div class="label">')
- html.append(translate(search_title, context=self.request))
- html.append('</div>')
- html.append('<div class="field">')
- html.append('<input type="text" name="%s" />' %(name+'.searchstring'))
- html.append('</div>')
- html.append('</div>')
-
- # add search button for search fields
- html.append('<div class="row">')
- html.append('<div class="field">')
- html.append('<input type="submit" name="%s" value="%s" />'
- % (name+'.search',
- translate(search_label, context=self.request)))
- html.append('</div>')
-
- # end row
- html.append('</div>')
-
- return '\n'.join(html)
-
def results(self, name):
if not (name+'.search' in self.request):
return None
Added: zope.app.security/trunk/src/zope/app/security/browser/authutilitysearchview.pt
===================================================================
--- zope.app.security/trunk/src/zope/app/security/browser/authutilitysearchview.pt (rev 0)
+++ zope.app.security/trunk/src/zope/app/security/browser/authutilitysearchview.pt 2009-02-15 23:57:55 UTC (rev 96575)
@@ -0,0 +1,21 @@
+<tal:block i18n:domain="zope">
+ <h4 tal:content="options/title" i18n:translate="">principals.zcml</h4>
+ <div class="row">
+ <div class="label" i18n:translate="">
+ Search String
+ </div>
+ <div class="field">
+ <input type="text" name="some.searchstring"
+ tal:attributes="name string:${options/name}.searchstring"
+ />
+ </div>
+ </div>
+ <div class="row">
+ <div class="field">
+ <input type="submit" name="some.search" value="Search"
+ tal:attributes="name string:${options/name}.search"
+ i18n:attributes="value search-button"
+ />
+ </div>
+ </div>
+</tal:block>
More information about the Checkins
mailing list