Skip to content

Commit

Permalink
Merged trunk to branch. I still ahve 4 ftests failing, but I suspect, it
Browse files Browse the repository at this point in the history
will be fixed once I merge the changes of the last three days (hopefully).
  • Loading branch information
strichter committed Feb 10, 2005
1 parent 6189992 commit fa32655
Show file tree
Hide file tree
Showing 7 changed files with 460 additions and 409 deletions.
8 changes: 6 additions & 2 deletions authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def getPrincipal(self, id):
id = id[len(self.prefix):]

for searcher in self.searchers:
searcher = queryUtility(IPrincipalSearchPlugin, searcher)
searcher = queryUtility(IPrincipalSearchPlugin, searcher,
context=self)
if searcher is None:
continue

Expand All @@ -103,7 +104,10 @@ def getPrincipal(self, id):

def getQueriables(self):
for searcher_id in self.searchers:
searcher = queryUtility(IPrincipalSearchPlugin, searcher_id)
# ensure with context=self that we call it in the context if
# we call it form a PrincipalSource vocabulary
searcher = queryUtility(IPrincipalSearchPlugin, searcher_id,
context=self)
yield searcher_id, searcher


Expand Down
4 changes: 4 additions & 0 deletions authenticationplugins.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<require
permission="zope.ManageServices"
interface="zope.app.container.interfaces.IContainer" />

<require
permission="zope.ManageServices"
attributes="prefix" />

</localUtility>

Expand Down
8 changes: 8 additions & 0 deletions browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
index="zope.ManageServices"
/>

<schemadisplay
schema="..principalfolder.IInternalPrincipalContainer"
label="Principal Folder Prefix"
name="prefix.html"
fields="prefix"
permission="zope.ManageServices"
menu="zmi_views" title="Prefix" />

<editform
schema="..httpplugins.IHTTPBasicAuthRealm"
label="Change Realm"
Expand Down
49 changes: 33 additions & 16 deletions browser/schemasearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,59 @@ def render(self, name):
html = []

# add sub title for source search field
html.append('<h4 i18n:translate="">%s %s</h4>' % (sourcename, sourcepath))
html.append('<h4>%s</h4>' % sourcename)

# start row for path display field
html.append('<div class="row">')

# for each source add path of source
html.append(' <div class="label">')
label = _(u"Source path")
title = _(u"Path to the source utility")
html.append(' <label for="%s" title="%s">' % (sourcename, title))
html.append(' %s' % label)
html.append(' </label>')
html.append(' </div>')
html.append(' <div class="field">')
html.append(' %s' % sourcepath)
html.append(' </field>')
html.append(' </div>')
html.append('</div>')

# start row for search fields
html.append('<div class="row">')

for field_name, field in getFieldsInOrder(schema):
widget = getattr(self, field_name+'_widget')

# for each field add lable...
html.append('<div class="label">')
html.append('<label for="%s" title="%s">'
html.append(' <div class="label">')
html.append(' <label for="%s" title="%s">'
% (widget.name, widget.hint))
html.append(widget.label)
html.append('</label>')
html.append('</div>')
html.append(' %s' % widget.label)
html.append(' </label>')
html.append(' </div>')

# ...and field widget
html.append('<div class="field">')
html.append(widget())
html.append(' <div class="field">')
html.append(' %s' % widget())

if widget.error():
html.append('<div class="error">')
html.append(widget.error())
html.append('</div>')
html.append('</div>')
html.append(' <div class="error">')
html.append(' %s' % widget.error())
html.append(' </div>')
html.append(' </div>')
# end row
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" />'
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>')
html.append('</div>')
html.append('</div>')


return '\n'.join(html)

Expand Down
33 changes: 22 additions & 11 deletions browser/schemasearch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,33 @@ then we can get a view:
This allows us to render a search form.

>>> print view.render('test') # doctest: +NORMALIZE_WHITESPACE
<h4 i18n:translate="">searchplugin /searchplugin</h4>
<h4>searchplugin</h4>
<div class="row">
<div class="label">
<label for="test.field.search" title="">
Search String
</label>
<div class="label">
<label for="searchplugin" title="Path to the source utility">
Source path
</label>
</div>
<div class="field">
/searchplugin
</field>
</div>
</div>
<div class="field">
<input class="textType" id="test.field.search" name="test.field.search"
<div class="row">
<div class="label">
<label for="test.field.search" title="">
Search String
</label>
</div>
<div class="field">
<input class="textType" id="test.field.search" name="test.field.search"
size="20" type="text" value="" />
</div>
</div>
</div>
<div class="row">
<div class="field">
<input type="submit" name="test.search" value="Search" />
</div>
<div class="field">
<input type="submit" name="test.search" value="Search" />
</div>
</div>

If we ask for results:
Expand Down
Loading

0 comments on commit fa32655

Please sign in to comment.