Author: reebalazs
Date: Sat Mar 29 19:34:12 2008
New Revision: 53107

Modified:
   kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/kss_demo_index.pt
   kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/registry.py
Log:
Find the Zuite from catalog, llike in improve-demos branch

Modified: kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/kss_demo_index.pt
==============================================================================
--- kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/kss_demo_index.pt       
(original)
+++ kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/kss_demo_index.pt       
Sat Mar 29 19:34:12 2008
@@ -12,9 +12,6 @@
      <li>Run Selenium tests
        <form tal:attributes="action string:${context/absolute_url}/zuite.html">
           <ul>
-            <li>Link to Zelenium object:
-              <input type="text" name="path" value="zuite" />
-            </li>
             <li>Admin credentials, used for site creation:
               <input type="text" name="admin_username" value="admin" />
               <input type="password" name="admin_password" value="admin" />
@@ -30,8 +27,8 @@
       </li>
     </ul>
     <p class="help">
-      Zelenium object link must be an absolute path from the domain root, 
-      or a relative path from the demo SimpleContent's parent.
+      Credentials are used for site creation. They do not actually log you 
+      in or used for anything else in tests.
     </p>
       <tal:groups repeat="demo_group 
context/@@kss_demo_registry/getDemoGroups">
         <tal:plugin condition="python:demo_group['is_first_plugin_namespace'] 
and demo_group['plugin_namespace']==''">

Modified: kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/registry.py
==============================================================================
--- kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/registry.py     
(original)
+++ kukit/kss.demo/branch/1.4-kss-test/kss/demo/browser/registry.py     Sat Mar 
29 19:34:12 2008
@@ -8,6 +8,7 @@
 import os.path
 import re
 import urllib
+from plone.memoize import view
 try:
     from Products.Five import BrowserView
     BrowserView         # make pyflakes happy
@@ -122,8 +123,8 @@
         self.request.response.setHeader('Content-type', 
'text/html;charset=utf-8')
         return file(path).read()
 
-    def getZuiteHomePage(self, path):
-        """Redirects to the Zuite home page, Zuite object is found from 
path."""
+    def getZuiteHomePage(self):
+        """Redirects to the Zuite home page, Zuite object is found from 
catalog."""
         # XXX: this actually does some parameter name searching, which is not 
optimal. If you find
         # a better way to implement multiple submit buttons and have the form 
post a key-value pair
         # that tells us what we pressed, feel free to kill this code
@@ -142,9 +143,18 @@
         test_url = "%s/suite.html?%s" % (self.context.absolute_url(), 
params_string)
         test_param = urllib.quote(test_url)
         
-        zuite = self.context.aq_inner.aq_parent.restrictedTraverse(path)
-        html = "%s/core/TestRunner.html?test=%s" % (zuite.absolute_url(), 
test_param)
+        html = "%s/core/TestRunner.html?test=%s" % (self.zuite.absolute_url(), 
test_param)
         return self.request.response.redirect(html)
+    
+    @property
+    @view.memoize_contextless
+    def zuite(self):
+        """Finds a zuite in the same directory or under"""
+        container = self.context.aq_inner.aq_parent
+        zuites = self.context.ZopeFind(container, obj_metatypes=['Zuite'], 
search_sub=1)
+        if not zuites:
+            raise Exception, 'No Zuite found in the catalog. Create a Zuite or 
reindex catalog.'
+        return zuites[0][1]
 
 class KSSDemoRegistryAdminView(BrowserView):
     """Things that only admin should do"""
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to