Commits

Ralph Bean committed 580af7e Merge

Merge paj`s 2.5/windows support.

  • Participants
  • Parent commits 5d2add6, 70437e1

Comments (0)

Files changed (3)

File tests/test_transactions.py

-import tw2.core as twc, tw2.sqla as tws, sqlalchemy as sa, elixir as el, webtest, webob as wo, threading, os
+import tw2.core as twc, tw2.sqla as tws, sqlalchemy as sa, elixir as el, webtest, webob as wo, threading, os, random
 
 #import testapi
 
     def setup(self):
         #testapi.setup()
         # Note: we can't use :memory: from two threads
-        if os.path.exists('test.db'):
+        try:
             os.unlink('test.db')
+        except:
+            pass
         el.metadata = sa.MetaData('sqlite:///test.db')
         el.session = tws.transactional_session()
         class Test(el.Entity):

File tests/test_widgets.py

     attrs = {'css_class':'something', 'id' : 'something'}
     params = {'checked':None}
     expected = """
-    <ul class="something" name="something" id="something">
+    <ul class="something" id="something">
     <li>
         <input type="radio" name="something" value="1" id="something:0"/>
         <label for="something:0">foo1</label>
     attrs = {'css_class':'something', 'id' : 'something'}
     params = {'checked':None}
     expected = """
-    <ul class="something" name="something" id="something">
+    <ul class="something" id="something">
     <li>
         <input type="checkbox" name="something" value="1" id="something:0"/>
         <label for="something:0">foo1</label>
     attrs = {'css_class':'something', 'id' : 'something'}
     params = {'checked':None}
     expected = """
-    <table class="something" id="something" name="something"><tbody>
+    <table class="something" id="something"><tbody>
     <tr>
         <td>
             <input type="checkbox" name="something" value="1" id="something:0">

File tw2/sqla/widgets.py

 from zope.sqlalchemy import ZopeTransactionExtension
 import transaction
 
-from itertools import product
+
+try:
+    from itertools import product
+except ImportError:
+    # Python 2.5 support
+    def product(x, y):
+        for i in x:
+            for j in y:
+                yield (i,j)
 
 from tw2.sqla.utils import from_dict