[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Fix bug with
SourceInputWidget (couldn't find any mention in the collector)::
Benji York
benji at zope.com
Tue May 10 14:18:41 EDT 2005
Log message for revision 30321:
Fix bug with SourceInputWidget (couldn't find any mention in the collector)::
The widget's __init__ was creating a list of its queryviews and stashing
away the name (including the widget's prefix), then when the prefix
changed, the saved names wouldn't reflect that fact.
Instead, now queryviews is a property, so any change in the prefix (and
hence the name) are properly reflected.
Changed:
U Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt
U Zope3/trunk/src/zope/app/form/browser/source.py
U Zope3/trunk/src/zope/app/form/browser/source.txt
U Zope3/trunk/src/zope/app/securitypolicy/browser/granting_ftest.txt
-=-
Modified: Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt 2005-05-10 17:47:10 UTC (rev 30320)
+++ Zope3/trunk/src/zope/app/authentication/browser/group_searching_with_empty_string.txt 2005-05-10 18:18:41 UTC (rev 30321)
@@ -231,7 +231,7 @@
... Content-Type: application/x-www-form-urlencoded
... Referer: http://localhost:8081/@@grant.html
...
- ... field.principal.displayed=y&field.principal.MC5ncm91cHM_.query.field.search=&field.principal.MC5ncm91cHM_.query.search=Search&field.principal.MQ__.query.searchstring=""")
+ ... field.principal.displayed=y&field.principal.MC5ncm91cHM_.field.search=&field.principal.MC5ncm91cHM_.search=Search&field.principal.MQ__.searchstring=""")
HTTP/1.1 200 Ok
...Test1...Test2...
Modified: Zope3/trunk/src/zope/app/form/browser/source.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.py 2005-05-10 17:47:10 UTC (rev 30320)
+++ Zope3/trunk/src/zope/app/form/browser/source.py 2005-05-10 18:18:41 UTC (rev 30321)
@@ -112,23 +112,25 @@
zope.app.form.browser.interfaces.ITerms,
)
- queriables = ISourceQueriables(source, None)
+ def queryviews(self):
+ queriables = ISourceQueriables(self.source, None)
if queriables is None:
# treat the source itself as a queriable
- queriables = ((self.name, source), )
+ queriables = ((self.name + '.query', self.source), )
else:
- base = self.name+'.'
queriables = [
- (base +
+ (self.name + '.' +
unicode(i).encode('base64').strip().replace('=', '_'), s)
for (i, s) in queriables.getQueriables()]
- self.queryviews = [
- (i, zapi.getMultiAdapter(
- (s, self.request),
+ return [
+ (name, zapi.getMultiAdapter(
+ (source, self.request),
zope.app.form.browser.interfaces.ISourceQueryView,
)
- ) for (i, s) in queriables]
+ ) for (name, source) in queriables]
+
+ queryviews = property(queryviews)
def _value(self):
if self._renderedValueSet():
@@ -226,10 +228,10 @@
for name, queryview in self.queryviews:
result.append(' <div class="query">')
result.append(' <div class="queryinput">')
- result.append(queryview.render(name+'.query'))
+ result.append(queryview.render(name))
result.append(' </div> <!-- queryinput -->')
- qresults = queryview.results(name+'.query')
+ qresults = queryview.results(name)
if qresults:
result.append(' <div class="queryresults">\n%s' %
self._renderResults(qresults, name))
@@ -425,10 +427,10 @@
for name, queryview in self.queryviews:
result.append(' <div class="query">')
result.append(' <div class="queryinput">')
- result.append(queryview.render(name+'.query'))
+ result.append(queryview.render(name))
result.append(' </div> <!-- queryinput -->')
- qresults = queryview.results(name+'.query')
+ qresults = queryview.results(name)
if qresults:
result.append(' <div class="queryresults">\n%s' %
self._renderResults(qresults, name))
Modified: Zope3/trunk/src/zope/app/form/browser/source.txt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.txt 2005-05-10 17:47:10 UTC (rev 30320)
+++ Zope3/trunk/src/zope/app/form/browser/source.txt 2005-05-10 18:18:41 UTC (rev 30321)
@@ -203,11 +203,11 @@
<input type="submit" name="field.dog.query" value="Search">
</div> <!-- queryinput -->
<div class="queryresults">
- <select name="field.dog.selection">
+ <select name="field.dog.query.selection">
<option value="Ym93c2Vy">bowser</option>
<option value="c3BvdA==">spot</option>
</select>
- <input type="submit" name="field.dog.apply" value="Apply">
+ <input type="submit" name="field.dog.query.apply" value="Apply">
</div> <!-- queryresults -->
</div> <!-- query -->
</div> <!-- queries -->
@@ -218,8 +218,8 @@
>>> request.form['field.dog.displayed'] = u'y'
>>> del request.form['field.dog.query.string']
>>> del request.form['field.dog.query']
- >>> request.form['field.dog.selection'] = u'c3BvdA=='
- >>> request.form['field.dog.apply'] = u'Apply'
+ >>> request.form['field.dog.query.selection'] = u'c3BvdA=='
+ >>> request.form['field.dog.query.apply'] = u'Apply'
Then we'll show the newly selected value:
@@ -321,14 +321,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pet.MA__.query.string">
- <input type="submit" name="field.pet.MA__.query" value="Search">
+ <input name="field.pet.MA__.string">
+ <input type="submit" name="field.pet.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pet.MQ__.query.string">
- <input type="submit" name="field.pet.MQ__.query" value="Search">
+ <input name="field.pet.MQ__.string">
+ <input type="submit" name="field.pet.MQ__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
</div> <!-- queries -->
@@ -337,8 +337,8 @@
As before, we can perform a search:
>>> request.form['field.pet.displayed'] = u'y'
- >>> request.form['field.pet.MQ__.query.string'] = u't'
- >>> request.form['field.pet.MQ__.query'] = u'Search'
+ >>> request.form['field.pet.MQ__.string'] = u't'
+ >>> request.form['field.pet.MQ__'] = u'Search'
In which case, we'll get some results:
@@ -356,14 +356,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pet.MA__.query.string">
- <input type="submit" name="field.pet.MA__.query" value="Search">
+ <input name="field.pet.MA__.string">
+ <input type="submit" name="field.pet.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pet.MQ__.query.string">
- <input type="submit" name="field.pet.MQ__.query" value="Search">
+ <input name="field.pet.MQ__.string">
+ <input type="submit" name="field.pet.MQ__" value="Search">
</div> <!-- queryinput -->
<div class="queryresults">
<select name="field.pet.MQ__.selection">
@@ -381,8 +381,8 @@
from which we can choose:
>>> request.form['field.pet.displayed'] = u'y'
- >>> del request.form['field.pet.MQ__.query.string']
- >>> del request.form['field.pet.MQ__.query']
+ >>> del request.form['field.pet.MQ__.string']
+ >>> del request.form['field.pet.MQ__']
>>> request.form['field.pet.MQ__.selection'] = u'dGFiYnk='
>>> request.form['field.pet.MQ__.apply'] = u'Apply'
@@ -403,14 +403,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pet.MA__.query.string">
- <input type="submit" name="field.pet.MA__.query" value="Search">
+ <input name="field.pet.MA__.string">
+ <input type="submit" name="field.pet.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pet.MQ__.query.string">
- <input type="submit" name="field.pet.MQ__.query" value="Search">
+ <input name="field.pet.MQ__.string">
+ <input type="submit" name="field.pet.MQ__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
</div> <!-- queries -->
@@ -465,14 +465,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pets.MA__.query.string">
- <input type="submit" name="field.pets.MA__.query" value="Search">
+ <input name="field.pets.MA__.string">
+ <input type="submit" name="field.pets.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pets.MQ__.query.string">
- <input type="submit" name="field.pets.MQ__.query" value="Search">
+ <input name="field.pets.MQ__.string">
+ <input type="submit" name="field.pets.MQ__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
</div> <!-- queries -->
@@ -486,8 +486,8 @@
As before, we can search one of the sources:
>>> request.form['field.pets.displayed'] = u'y'
- >>> request.form['field.pets.MQ__.query.string'] = u't'
- >>> request.form['field.pets.MQ__.query'] = u'Search'
+ >>> request.form['field.pets.MQ__.string'] = u't'
+ >>> request.form['field.pets.MQ__'] = u'Search'
In which case, we'll get some results:
@@ -497,14 +497,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pets.MA__.query.string">
- <input type="submit" name="field.pets.MA__.query" value="Search">
+ <input name="field.pets.MA__.string">
+ <input type="submit" name="field.pets.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pets.MQ__.query.string">
- <input type="submit" name="field.pets.MQ__.query" value="Search">
+ <input name="field.pets.MQ__.string">
+ <input type="submit" name="field.pets.MQ__" value="Search">
</div> <!-- queryinput -->
<div class="queryresults">
<select name="field.pets.MQ__.selection:list" multiple>
@@ -522,8 +522,8 @@
from which we can select some values:
>>> request.form['field.pets.displayed'] = u'y'
- >>> del request.form['field.pets.MQ__.query.string']
- >>> del request.form['field.pets.MQ__.query']
+ >>> del request.form['field.pets.MQ__.string']
+ >>> del request.form['field.pets.MQ__']
>>> request.form['field.pets.MQ__.selection'] = [
... u'dGFiYnk=', u'dGlnZXI=', u'dG9t']
>>> request.form['field.pets.MQ__.apply'] = u'Apply'
@@ -550,14 +550,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pets.MA__.query.string">
- <input type="submit" name="field.pets.MA__.query" value="Search">
+ <input name="field.pets.MA__.string">
+ <input type="submit" name="field.pets.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pets.MQ__.query.string">
- <input type="submit" name="field.pets.MQ__.query" value="Search">
+ <input name="field.pets.MQ__.string">
+ <input type="submit" name="field.pets.MQ__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
</div> <!-- queries -->
@@ -590,14 +590,14 @@
<div class="queries">
<div class="query">
<div class="queryinput">
- <input name="field.pets.MA__.query.string">
- <input type="submit" name="field.pets.MA__.query" value="Search">
+ <input name="field.pets.MA__.string">
+ <input type="submit" name="field.pets.MA__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
<div class="query">
<div class="queryinput">
- <input name="field.pets.MQ__.query.string">
- <input type="submit" name="field.pets.MQ__.query" value="Search">
+ <input name="field.pets.MQ__.string">
+ <input type="submit" name="field.pets.MQ__" value="Search">
</div> <!-- queryinput -->
</div> <!-- query -->
</div> <!-- queries -->
Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/granting_ftest.txt
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/granting_ftest.txt 2005-05-10 17:47:10 UTC (rev 30320)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/granting_ftest.txt 2005-05-10 18:18:41 UTC (rev 30321)
@@ -26,8 +26,8 @@
... Referer: http://localhost:8081/@@grant.html
...
... field.principal.displayed=y"""
- ... """&field.principal.MA__.query.searchstring="""
- ... """&field.principal.MA__.query.search=Search""")
+ ... """&field.principal.MA__.searchstring="""
+ ... """&field.principal.MA__.search=Search""")
HTTP/1.1 200 Ok
...
<option value="em9wZS5tZ3I_">Manager</option>
@@ -44,7 +44,7 @@
... Referer: http://localhost:8081/@@grant.html
...
... field.principal.displayed=y"""
- ... """&field.principal.MA__.query.searchstring="""
+ ... """&field.principal.MA__.searchstring="""
... """&field.principal.MA__.selection=em9wZS5tZ3I_"""
... """&field.principal.MA__.apply=Apply""")
HTTP/1.1 200 Ok
@@ -123,7 +123,7 @@
...
... field.principal=em9wZS5tZ3I_"""
... """&field.principal.displayed=y"""
- ... """&field.principal.MA__.query.searchstring="""
+ ... """&field.principal.MA__.searchstring="""
... """&field.em9wZS5tZ3I_.role.zope.Member=allow"""
... """&field.em9wZS5tZ3I_.role.zope.Member-empty-marker=1"""
... """&field.em9wZS5tZ3I_.permission.zope.ManageCode=deny"""
More information about the Zope3-Checkins
mailing list