[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Updated to use modified base64 encoding, substituting _ for =

Jim Fulton jim at zope.com
Tue Oct 19 15:15:57 EDT 2004


Log message for revision 28213:
  Updated to use modified base64 encoding, substituting _ for =
  

Changed:
  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/security/browser/principalterms.py
  U   Zope3/trunk/src/zope/app/security/browser/principalterms.txt

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/source.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.py	2004-10-18 20:01:20 UTC (rev 28212)
+++ Zope3/trunk/src/zope/app/form/browser/source.py	2004-10-19 19:15:57 UTC (rev 28213)
@@ -85,7 +85,9 @@
             queriables = ((self.name, source), )
         else:
             base = self.name+'.'
-            queriables = [(base + unicode(i).encode('base64').strip(), s)
+            queriables = [
+                (base +
+                 unicode(i).encode('base64').strip().replace('=', '_'), s)
                           for (i, s) in queriables.getQueriables()]
             
         self.queryviews = [

Modified: Zope3/trunk/src/zope/app/form/browser/source.txt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/source.txt	2004-10-18 20:01:20 UTC (rev 28212)
+++ Zope3/trunk/src/zope/app/form/browser/source.txt	2004-10-19 19:15:57 UTC (rev 28213)
@@ -297,14 +297,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__.query.string">
+  <input type="submit" name="field.pet.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pet.MQ__.query" value="Search">
         </div> <!-- queryinput -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -313,8 +313,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__.query.string'] = u't'
+  >>> request.form['field.pet.MQ__.query'] = u'Search'
 
 In which case, we'll get some results:
 
@@ -326,23 +326,23 @@
     <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__.query.string">
+  <input type="submit" name="field.pet.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pet.MQ__.query" value="Search">
         </div> <!-- queryinput -->
         <div class="queryresults">
-  <select name="field.pet.MQ==.selection">
+  <select name="field.pet.MQ__.selection">
   <option value="Ym9vdHM=">boots</option>
   <option value="dGFiYnk=">tabby</option>
   <option value="dGlnZXI=">tiger</option>
   <option value="dG9t">tom</option>
   </select>
-  <input type="submit" name="field.pet.MQ==.apply" value="Apply">
+  <input type="submit" name="field.pet.MQ__.apply" value="Apply">
         </div> <!-- queryresults -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -351,10 +351,10 @@
 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']
-  >>> request.form['field.pet.MQ==.selection'] = u'dGFiYnk='
-  >>> request.form['field.pet.MQ==.apply'] = u'Apply'
+  >>> del request.form['field.pet.MQ__.query.string']
+  >>> del request.form['field.pet.MQ__.query']
+  >>> request.form['field.pet.MQ__.selection'] = u'dGFiYnk='
+  >>> request.form['field.pet.MQ__.apply'] = u'Apply'
 
 and get a selection:
 
@@ -367,14 +367,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__.query.string">
+  <input type="submit" name="field.pet.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pet.MQ__.query" value="Search">
         </div> <!-- queryinput -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -424,14 +424,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__.query.string">
+  <input type="submit" name="field.pets.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pets.MQ__.query" value="Search">
         </div> <!-- queryinput -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -445,8 +445,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__.query.string'] = u't'
+  >>> request.form['field.pets.MQ__.query'] = u'Search'
 
 In which case, we'll get some results:
 
@@ -456,23 +456,23 @@
     <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__.query.string">
+  <input type="submit" name="field.pets.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pets.MQ__.query" value="Search">
         </div> <!-- queryinput -->
         <div class="queryresults">
-  <select name="field.pets.MQ==.selection:list" multiple>
+  <select name="field.pets.MQ__.selection:list" multiple>
   <option value="Ym9vdHM=">boots</option>
   <option value="dGFiYnk=">tabby</option>
   <option value="dGlnZXI=">tiger</option>
   <option value="dG9t">tom</option>
   </select>
-  <input type="submit" name="field.pets.MQ==.apply" value="Apply">
+  <input type="submit" name="field.pets.MQ__.apply" value="Apply">
         </div> <!-- queryresults -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -481,11 +481,11 @@
 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']
-  >>> request.form['field.pets.MQ==.selection'] = [
+  >>> del request.form['field.pets.MQ__.query.string']
+  >>> del request.form['field.pets.MQ__.query']
+  >>> request.form['field.pets.MQ__.selection'] = [
   ...     u'dGFiYnk=', u'dGlnZXI=', u'dG9t']
-  >>> request.form['field.pets.MQ==.apply'] = u'Apply'
+  >>> request.form['field.pets.MQ__.apply'] = u'Apply'
 
 Which then leads to the selections appearing as widget selections:
 
@@ -509,14 +509,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__.query.string">
+  <input type="submit" name="field.pets.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pets.MQ__.query" value="Search">
         </div> <!-- queryinput -->
       </div> <!-- query -->
     </div> <!-- queries -->
@@ -532,8 +532,8 @@
 
   >>> request.form['field.pets.displayed'] = u'y'
   >>> request.form['field.pets'] = [u'dGFiYnk=', u'dGlnZXI=', u'dG9t']
-  >>> del request.form['field.pets.MQ==.selection']
-  >>> del request.form['field.pets.MQ==.apply']
+  >>> del request.form['field.pets.MQ__.selection']
+  >>> del request.form['field.pets.MQ__.apply']
   >>> request.form['field.pets.checked'] = [u'dGFiYnk=', u'dG9t']
   >>> request.form['field.pets.remove'] = u'Remove'
 
@@ -549,14 +549,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__.query.string">
+  <input type="submit" name="field.pets.MA__.query" 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__.query.string">
+  <input type="submit" name="field.pets.MQ__.query" value="Search">
         </div> <!-- queryinput -->
       </div> <!-- query -->
     </div> <!-- queries -->

Modified: Zope3/trunk/src/zope/app/security/browser/principalterms.py
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/principalterms.py	2004-10-18 20:01:20 UTC (rev 28212)
+++ Zope3/trunk/src/zope/app/security/browser/principalterms.py	2004-10-19 19:15:57 UTC (rev 28213)
@@ -48,7 +48,8 @@
         if principal is None:
             raise LookupError, principal_id
 
-        return Term(principal_id.encode('base64').strip(), principal.title)
+        return Term(principal_id.encode('base64').strip().replace('=', '_'),
+                    principal.title)
 
     def getValue(self, token):
-        return token.decode('base64')
+        return token.replace('_', '=').decode('base64')

Modified: Zope3/trunk/src/zope/app/security/browser/principalterms.txt
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/principalterms.txt	2004-10-18 20:01:20 UTC (rev 28212)
+++ Zope3/trunk/src/zope/app/security/browser/principalterms.txt	2004-10-19 19:15:57 UTC (rev 28213)
@@ -47,7 +47,7 @@
   >>> term.title
   'Stephan Richter'
   >>> term.token
-  'c3RlcGhhbg=='
+  'c3RlcGhhbg__'
 
 If we ask for a term that does not exist, we get a lookup error:
 
@@ -58,5 +58,5 @@
 
 If we have a token, we can get the principal id for it.
 
-  >>> terms.getValue('c3RlcGhhbg==')
-  'stephan'
\ No newline at end of file
+  >>> terms.getValue('c3RlcGhhbg__')
+  'stephan'



More information about the Zope3-Checkins mailing list