[Checkins] SVN: Sandbox/luciano/kirbi/src/kirbi/ updated to latest grokproject/egg-based grok

Luciano Ramalho luciano at ramalho.org
Tue Jul 17 02:01:43 EDT 2007


Log message for revision 78053:
  updated to latest grokproject/egg-based grok
  

Changed:
  U   Sandbox/luciano/kirbi/src/kirbi/app.py
  U   Sandbox/luciano/kirbi/src/kirbi/book.py
  U   Sandbox/luciano/kirbi/src/kirbi/book_templates/details.pt
  U   Sandbox/luciano/kirbi/src/kirbi/configure.zcml
  A   Sandbox/luciano/kirbi/src/kirbi/ftesting.zcml
  U   Sandbox/luciano/kirbi/src/kirbi/pac.py
  A   Sandbox/luciano/kirbi/src/kirbi/testing.py

-=-
Modified: Sandbox/luciano/kirbi/src/kirbi/app.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/app.py	2007-07-17 04:01:41 UTC (rev 78052)
+++ Sandbox/luciano/kirbi/src/kirbi/app.py	2007-07-17 06:01:43 UTC (rev 78053)
@@ -21,7 +21,8 @@
     isbn13 = index.Field()
     searchableText = index.Text()
     
-    #XXX: this is not working: the creatorSet book method is never called
+    #XXX: check whether this is working:
+    # the creatorSet book method was not being called
     creatorsSet = index.Set()
     
 class Master(grok.View):

Modified: Sandbox/luciano/kirbi/src/kirbi/book.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/book.py	2007-07-17 04:01:41 UTC (rev 78052)
+++ Sandbox/luciano/kirbi/src/kirbi/book.py	2007-07-17 06:01:43 UTC (rev 78053)
@@ -226,14 +226,11 @@
         return creators
 
     def creatorsSet(self):
-        #XXX: this is never invoked so the creatorSet index in app.py is not
-        # being pupulated
         creators = set()
-        for creator in self.creators():
+        for creator in self.creators:
             if '(' in creator: # remove role string
                 creator = creator.split('(')[0]
             creators.add(creator.strip().lower())
-        import pdb; pdb.set_trace()
         return list(creators)
     
     def searchableText(self):
@@ -258,6 +255,7 @@
         self.main_title = self.context.main_title
         self.sub_title = self.context.sub_title
         self.isbn13 = self.context.isbn13
+        self.creator_search_url =  self.application_url('pac')+'?query=cr:'
         
     def coverUrl(self):
         cover_name = 'covers/medium/'+self.context.__name__+'.jpg'

Modified: Sandbox/luciano/kirbi/src/kirbi/book_templates/details.pt
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/book_templates/details.pt	2007-07-17 04:01:41 UTC (rev 78052)
+++ Sandbox/luciano/kirbi/src/kirbi/book_templates/details.pt	2007-07-17 06:01:43 UTC (rev 78053)
@@ -31,8 +31,9 @@
                     <tal:comment replace="nothing">Next few lines have weird
                         indentation because of the need to control the spaces
                         between names and the comma</tal:comment>
-                    <a tal:attributes="href python:view.application_url('pac')+
-                       '?query='+creator['name']" tal:content="creator/name">
+                    <a tal:attributes="href
+                       string:${view/creator_search_url}${creator/name}"
+                       tal:content="creator/name">
                     Joe Doe</a><tal:role condition="creator/role">
                     (<span tal:replace="creator/role" />)</tal:role><tal:comma
                        condition="not:repeat/creator/end">, </tal:comma>

Modified: Sandbox/luciano/kirbi/src/kirbi/configure.zcml
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/configure.zcml	2007-07-17 04:01:41 UTC (rev 78052)
+++ Sandbox/luciano/kirbi/src/kirbi/configure.zcml	2007-07-17 06:01:43 UTC (rev 78053)
@@ -1 +1,5 @@
-<grok package="." xmlns="http://namespaces.zope.org/grok" />
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:grok="http://namespaces.zope.org/grok">
+  <include package="grok" />
+  <grok:grok package="." />
+</configure>

Added: Sandbox/luciano/kirbi/src/kirbi/ftesting.zcml
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/ftesting.zcml	                        (rev 0)
+++ Sandbox/luciano/kirbi/src/kirbi/ftesting.zcml	2007-07-17 06:01:43 UTC (rev 78053)
@@ -0,0 +1,34 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   i18n_domain="kirbi"
+   package="kirbi"
+   >
+
+  <include package="grok" />
+
+  <!-- Typical functional testing security setup -->
+  <securityPolicy
+      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      />
+
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User"
+      />
+  <grant
+      permission="zope.View"
+      principal="zope.anybody"
+      />
+
+  <principal
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw"
+      />
+
+  <role id="zope.Manager" title="Site Manager" />
+  <grantAll role="zope.Manager" />
+  <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>

Modified: Sandbox/luciano/kirbi/src/kirbi/pac.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/pac.py	2007-07-17 04:01:41 UTC (rev 78052)
+++ Sandbox/luciano/kirbi/src/kirbi/pac.py	2007-07-17 06:01:43 UTC (rev 78053)
@@ -31,8 +31,6 @@
             self.results_title = 'All items'
         else:
             catalog = getUtility(ICatalog)
-            # Note: queries with a cr: prefix are creator queries
-            # XXX: this is not working: the book.creatorSet is never invoked
             if query.startswith(u'cr:'):
                 query = query[3:].strip().lower()
                 set_query = {'any_of': [query]}

Added: Sandbox/luciano/kirbi/src/kirbi/testing.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/testing.py	                        (rev 0)
+++ Sandbox/luciano/kirbi/src/kirbi/testing.py	2007-07-17 06:01:43 UTC (rev 78053)
@@ -0,0 +1,7 @@
+import os.path
+import kirbi
+from zope.app.testing.functional import ZCMLLayer
+
+ftesting_zcml = os.path.join(
+    os.path.dirname(kirbi.__file__), 'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')



More information about the Checkins mailing list