[Checkins] SVN: zc.selenium/trunk/s Added the ability to have ZRT directives in selenium. We use this to

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Jun 9 16:24:04 EDT 2008


Log message for revision 87255:
  Added the ability to have ZRT directives in selenium. We use this to 
  dynamically change the URL upon run time. Works great with the Selenium 
  IDE as well.
  
  Here is an example of a comment in one of our files::
  
   /* zrt-replace: "http://localhost:8080" tal"request/URL/0" */ 
  
  

Changed:
  U   zc.selenium/trunk/setup.py
  U   zc.selenium/trunk/src/zc/selenium/htmltest.py

-=-
Modified: zc.selenium/trunk/setup.py
===================================================================
--- zc.selenium/trunk/setup.py	2008-06-09 16:49:20 UTC (rev 87254)
+++ zc.selenium/trunk/setup.py	2008-06-09 20:24:02 UTC (rev 87255)
@@ -17,5 +17,6 @@
         'zope.interface',
         'zope.component',
         'zope.publisher',
+        'z3c.zrtresource',
     ]
 )

Modified: zc.selenium/trunk/src/zc/selenium/htmltest.py
===================================================================
--- zc.selenium/trunk/src/zc/selenium/htmltest.py	2008-06-09 16:49:20 UTC (rev 87254)
+++ zc.selenium/trunk/src/zc/selenium/htmltest.py	2008-06-09 20:24:02 UTC (rev 87255)
@@ -19,8 +19,10 @@
 __docformat__ = "reStructuredText"
 import os
 import zope.interface
+from zope.app.component import hooks
 from zc.selenium.pytest import ISeleniumTest
 from zc.selenium.resource import ResourceBase
+from z3c.zrtresource import processor, replace
 
 
 class HTMLTableSeleniumTest(ResourceBase):
@@ -29,7 +31,9 @@
     filename = None
 
     def __call__(self):
-        return open(self.filename, 'r').read()
+        data = open(self.filename, 'r').read()
+        p = processor.ZRTProcessor(data, commands={'replace': replace.Replace})
+        return p.process(hooks.getSite(), self.request)
 
     GET = __call__
 



More information about the Checkins mailing list