[Checkins] SVN: Sandbox/gotcha/z3c.taskqueue_ui/trunk/ tests are running but fail

Godefroid Chapelle gotcha at bubblenet.be
Mon Oct 11 10:27:04 EDT 2010


Log message for revision 117454:
  tests are running but fail

Changed:
  U   Sandbox/gotcha/z3c.taskqueue_ui/trunk/buildout.cfg
  U   Sandbox/gotcha/z3c.taskqueue_ui/trunk/setup.py
  D   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt
  A   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt
  U   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/configure.zcml
  U   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/service.py
  A   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/configure.zcml
  U   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/ftesting.zcml
  A   Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/tests.py

-=-
Modified: Sandbox/gotcha/z3c.taskqueue_ui/trunk/buildout.cfg
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/buildout.cfg	2010-10-11 13:55:26 UTC (rev 117453)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/buildout.cfg	2010-10-11 14:27:04 UTC (rev 117454)
@@ -11,7 +11,7 @@
 [test]
 recipe = zc.recipe.testrunner
 defaults = ['--tests-pattern', '^f?tests$']
-eggs = z3c.taskqueue_ui
+eggs = z3c.taskqueue_ui [test]
 
 [py]
 recipe = zc.recipe.egg

Modified: Sandbox/gotcha/z3c.taskqueue_ui/trunk/setup.py
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/setup.py	2010-10-11 13:55:26 UTC (rev 117453)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/setup.py	2010-10-11 14:27:04 UTC (rev 117454)
@@ -26,6 +26,17 @@
           'z3c.taskqueue',
           'z3c.table',
       ],
+      extras_require=dict(test=['zope.app.testing',
+                                  'zope.testing',
+                                  'zope.app.securitypolicy',
+                                  'zope.app.zcmlfiles',
+                                  'zope.app.authentication',
+                                  'zope.app.component',
+                                  'zope.app.folder',
+                                  'zope.login',
+                                  'zope.securitypolicy',
+                                  'zope.testbrowser',
+                                  ]),
       entry_points="""
       # -*- Entry points: -*-
       """,

Deleted: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt	2010-10-11 13:55:26 UTC (rev 117453)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt	2010-10-11 14:27:04 UTC (rev 117454)
@@ -1,259 +0,0 @@
-==================================
-Task Service Browser Management UI
-==================================
-
-Let's start a browser:
-
-  >>> from zope.testbrowser.testing import Browser
-  >>> browser = Browser()
-  >>> browser.addHeader('Authorization','Basic mgr:mgrpw')
-  >>> browser.handleErrors = False
-
-Now we add a task service:
-
-  >>> browser.open('http://localhost/manage')
-  >>> browser.getLink('Remote Task Service').click()
-  >>> browser.getControl(name='new_value').value = 'tasks'
-  >>> browser.getControl('Apply').click()
-
-Now let's have a look at the job's table:
-
-  >>> browser.getLink('tasks').click()
-
-You can see the available tasks:
-
-  >>> 'Available Tasks' in browser.contents
-  True
-
-By default there is an "echo" task:
-
-  >>> '<div>echo</div>' in browser.contents
-  True
-
-Below you see a table of all the jobs. Initially we have no jobs, so let's add
-one via XML-RPC:
-
-  >>> print http(r"""
-  ... POST /tasks/ HTTP/1.0
-  ... Authorization: Basic mgr:mgrpw
-  ... Content-Type: text/xml
-  ...
-  ... <?xml version='1.0'?>
-  ... <methodCall>
-  ... <methodName>add</methodName>
-  ... <params>
-  ... <value><string>echo</string></value>
-  ... <value><struct>
-  ... <key><string>foo</string></key>
-  ... <value><string>bar</string></value>
-  ... </struct></value>
-  ... </params>
-  ... </methodCall>
-  ... """)
-  HTTP/1.0 200 Ok
-  ...
-
-If we now refresh the screen, we will see the new job:
-
-  >>> browser.reload()
-  >>> print browser.contents
-  <!DOCTYPE ...
-  <tbody>
-  <tr class="odd">
-    <td class="">
-      <input type="checkbox" name="jobs:list" value="1506179619">
-    </td>
-    <td class="tableId">
-      1506179619
-    </td>
-    <td class="tableTask">
-      echo
-    </td>
-    <td class="tableStatus">
-      <span class="status-queued">queued</span>
-    </td>
-    <td class="tableDetail">
-      No input detail available
-    </td>
-    <td class="tableCreated">
-      ...
-    </td>
-    <td class="tableStart">
-      [not set]
-    </td>
-    <td class="tableEnd">
-      [not set]
-    </td>
-  </tr>
-  </tbody>
-  ...
-
-It is possible to provide custom views for the details. Note the name of the
-view "echo_detail", it consists of the task name and "_detail". This allows us
-to use different detail views on the same job classes. if no such view is
-found a view with name 'detail' is searched.
-
-  >>> from zope import interface
-  >>> from zope.publisher.interfaces.browser import IBrowserView
-  >>> class EchoDetailView(object):
-  ...     interface.implements(IBrowserView)
-  ...     def __init__(self, context, request):
-  ...         self.context = context
-  ...         self.request = request
-  ...     def __call__(self):
-  ...         return u'echo: foo=%s'% self.context.input['foo']
-  >>> from lovely.remotetask.interfaces import IJob
-  >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-  >>> from zope import component
-  >>> component.provideAdapter(EchoDetailView,
-  ...                          (IJob, IDefaultBrowserLayer),
-  ...                          name='echo_detail')
-  >>> browser.reload()
-  >>> print browser.contents
-  <!DOCTYPE
-  ...
-  <td class="tableDetail">
-    echo: foo=bar
-  ...
-
-You can cancel scheduled jobs:
-
-  >>> browser.getControl('Cancel', index=0).click()
-  >>> 'No jobs were selected.' in browser.contents
-  True
-
-  >>> browser.getControl(name='jobs:list').getControl(
-  ...     value='1506179619').click()
-  >>> browser.getControl('Cancel', index=0).click()
-  >>> 'Jobs were successfully cancelled.' in browser.contents
-  True
-
-It is also possible cancel all jobs::
-
-  >>> browser.getControl('Cancel all', index=0).click()
-  >>> 'All jobs cancelled' in browser.contents
-  True
-
-You can also clean attic jobs:
-
-  >>> browser.getControl('Remove all').click()
-  >>> 'Cleaned 1 Jobs' in  browser.contents
-  True
-
-
-Thread Exception Reporting
---------------------------
-
-If a job raises an exception the task service repeats the job 3 times. On
-every exception a traceback is written to the log.
-
-We modify the python logger to get the log output.
-
-  >>> import logging
-  >>> logger = logging.getLogger("lovely.remotetask")
-  >>> logger.setLevel(logging.ERROR)
-  >>> import StringIO
-  >>> io = StringIO.StringIO()
-  >>> ch = logging.StreamHandler(io)
-  >>> ch.setLevel(logging.DEBUG)
-  >>> logger.addHandler(ch)
-
-  >>> from time import sleep
-  >>> from zope import component
-  >>> from lovely.remotetask.interfaces import ITaskService
-  >>> service = getRootFolder()['tasks']
-
-We add a job for a task which raises a ZeroDivisionError every time it is
-called.
-
-  >>> jobid = service.add(u'exception')
-  >>> service.getStatus(jobid)
-  'queued'
-  >>> import transaction
-  >>> transaction.commit()
-  >>> service.startProcessing()
-  >>> transaction.commit()
-
-  >>> import time
-  >>> time.sleep(1.5)
-
-
-Note that the processing thread is daemonic, that way it won't keep the process
-alive unnecessarily.
-
-  >>> import threading
-  >>> for thread in threading.enumerate():
-  ...     if thread.getName().startswith('remotetasks.'):
-  ...         print thread.isDaemon()
-  True
-
-  >>> service.stopProcessing()
-  >>> transaction.commit()
-
-
-We got log entries with the tracebacks of the division error.
-
-  >>> logvalue = io.getvalue()
-  >>> print logvalue
-  Caught a generic exception, preventing thread from crashing
-  integer division or modulo by zero
-  Traceback (most recent call last):
-  ...
-  ZeroDivisionError: integer division or modulo by zero
-  <BLANKLINE>
-
-We had 3 retries, but every error is reported twice, once by the processor and
-once from by the task service.
-
-  >>> logvalue.count('ZeroDivisionError')
-  6
-
-The job status is set to 'error'.
-
-  >>> service.getStatus(jobid)
-  'error'
-
-We do the same again to see if the same thing happens again. This test is
-necessary to see if the internal runCount in the task service is reset.
-
-  >>> io.seek(0)
-  >>> jobid = service.add(u'exception')
-  >>> service.getStatus(jobid)
-  'queued'
-  >>> import transaction
-  >>> transaction.commit()
-  >>> service.startProcessing()
-  >>> transaction.commit()
-  >>> sleep(1.5)
-  >>> service.stopProcessing()
-  >>> transaction.commit()
-
-We got log entries with the tracebacks of the division error.
-
-  >>> logvalue = io.getvalue()
-  >>> print logvalue
-  Caught a generic exception, preventing thread from crashing
-  integer division or modulo by zero
-  Traceback (most recent call last):
-  ...
-  ZeroDivisionError: integer division or modulo by zero
-  <BLANKLINE>
-
-We had 3 retries, but every error is reported twice, once by the processor and
-once from by the task service.
-
-  >>> logvalue.count('ZeroDivisionError')
-  6
-
-The job status is set to 'error'.
-
-  >>> service.getStatus(jobid)
-  'error'
-
-
-Clenaup
--------
-
-Allow the threads to exit:
-
-  >>> sleep(0.2)

Copied: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt (from rev 117449, Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt)
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt	                        (rev 0)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/README.txt	2010-10-11 14:27:04 UTC (rev 117454)
@@ -0,0 +1,259 @@
+==================================
+Task Service Browser Management UI
+==================================
+
+Let's start a browser:
+
+  >>> from zope.testbrowser.testing import Browser
+  >>> browser = Browser()
+  >>> browser.addHeader('Authorization','Basic mgr:mgrpw')
+  >>> browser.handleErrors = False
+
+Now we add a task service:
+
+  >>> browser.open('http://localhost/manage')
+  >>> browser.getLink('Remote Task Service').click()
+  >>> browser.getControl(name='new_value').value = 'tasks'
+  >>> browser.getControl('Apply').click()
+
+Now let's have a look at the job's table:
+
+  >>> browser.getLink('tasks').click()
+
+You can see the available tasks:
+
+  >>> 'Available Tasks' in browser.contents
+  True
+
+By default there is an "echo" task:
+
+  >>> '<div>echo</div>' in browser.contents
+  True
+
+Below you see a table of all the jobs. Initially we have no jobs, so let's add
+one via XML-RPC:
+
+  >>> print http(r"""
+  ... POST /tasks/ HTTP/1.0
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Type: text/xml
+  ...
+  ... <?xml version='1.0'?>
+  ... <methodCall>
+  ... <methodName>add</methodName>
+  ... <params>
+  ... <value><string>echo</string></value>
+  ... <value><struct>
+  ... <key><string>foo</string></key>
+  ... <value><string>bar</string></value>
+  ... </struct></value>
+  ... </params>
+  ... </methodCall>
+  ... """)
+  HTTP/1.0 200 Ok
+  ...
+
+If we now refresh the screen, we will see the new job:
+
+  >>> browser.reload()
+  >>> print browser.contents
+  <!DOCTYPE ...
+  <tbody>
+  <tr class="odd">
+    <td class="">
+      <input type="checkbox" name="jobs:list" value="1506179619">
+    </td>
+    <td class="tableId">
+      1506179619
+    </td>
+    <td class="tableTask">
+      echo
+    </td>
+    <td class="tableStatus">
+      <span class="status-queued">queued</span>
+    </td>
+    <td class="tableDetail">
+      No input detail available
+    </td>
+    <td class="tableCreated">
+      ...
+    </td>
+    <td class="tableStart">
+      [not set]
+    </td>
+    <td class="tableEnd">
+      [not set]
+    </td>
+  </tr>
+  </tbody>
+  ...
+
+It is possible to provide custom views for the details. Note the name of the
+view "echo_detail", it consists of the task name and "_detail". This allows us
+to use different detail views on the same job classes. if no such view is
+found a view with name 'detail' is searched.
+
+  >>> from zope import interface
+  >>> from zope.publisher.interfaces.browser import IBrowserView
+  >>> class EchoDetailView(object):
+  ...     interface.implements(IBrowserView)
+  ...     def __init__(self, context, request):
+  ...         self.context = context
+  ...         self.request = request
+  ...     def __call__(self):
+  ...         return u'echo: foo=%s'% self.context.input['foo']
+  >>> from lovely.remotetask.interfaces import IJob
+  >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+  >>> from zope import component
+  >>> component.provideAdapter(EchoDetailView,
+  ...                          (IJob, IDefaultBrowserLayer),
+  ...                          name='echo_detail')
+  >>> browser.reload()
+  >>> print browser.contents
+  <!DOCTYPE
+  ...
+  <td class="tableDetail">
+    echo: foo=bar
+  ...
+
+You can cancel scheduled jobs:
+
+  >>> browser.getControl('Cancel', index=0).click()
+  >>> 'No jobs were selected.' in browser.contents
+  True
+
+  >>> browser.getControl(name='jobs:list').getControl(
+  ...     value='1506179619').click()
+  >>> browser.getControl('Cancel', index=0).click()
+  >>> 'Jobs were successfully cancelled.' in browser.contents
+  True
+
+It is also possible cancel all jobs::
+
+  >>> browser.getControl('Cancel all', index=0).click()
+  >>> 'All jobs cancelled' in browser.contents
+  True
+
+You can also clean attic jobs:
+
+  >>> browser.getControl('Remove all').click()
+  >>> 'Cleaned 1 Jobs' in  browser.contents
+  True
+
+
+Thread Exception Reporting
+--------------------------
+
+If a job raises an exception the task service repeats the job 3 times. On
+every exception a traceback is written to the log.
+
+We modify the python logger to get the log output.
+
+  >>> import logging
+  >>> logger = logging.getLogger("lovely.remotetask")
+  >>> logger.setLevel(logging.ERROR)
+  >>> import StringIO
+  >>> io = StringIO.StringIO()
+  >>> ch = logging.StreamHandler(io)
+  >>> ch.setLevel(logging.DEBUG)
+  >>> logger.addHandler(ch)
+
+  >>> from time import sleep
+  >>> from zope import component
+  >>> from lovely.remotetask.interfaces import ITaskService
+  >>> service = getRootFolder()['tasks']
+
+We add a job for a task which raises a ZeroDivisionError every time it is
+called.
+
+  >>> jobid = service.add(u'exception')
+  >>> service.getStatus(jobid)
+  'queued'
+  >>> import transaction
+  >>> transaction.commit()
+  >>> service.startProcessing()
+  >>> transaction.commit()
+
+  >>> import time
+  >>> time.sleep(1.5)
+
+
+Note that the processing thread is daemonic, that way it won't keep the process
+alive unnecessarily.
+
+  >>> import threading
+  >>> for thread in threading.enumerate():
+  ...     if thread.getName().startswith('remotetasks.'):
+  ...         print thread.isDaemon()
+  True
+
+  >>> service.stopProcessing()
+  >>> transaction.commit()
+
+
+We got log entries with the tracebacks of the division error.
+
+  >>> logvalue = io.getvalue()
+  >>> print logvalue
+  Caught a generic exception, preventing thread from crashing
+  integer division or modulo by zero
+  Traceback (most recent call last):
+  ...
+  ZeroDivisionError: integer division or modulo by zero
+  <BLANKLINE>
+
+We had 3 retries, but every error is reported twice, once by the processor and
+once from by the task service.
+
+  >>> logvalue.count('ZeroDivisionError')
+  6
+
+The job status is set to 'error'.
+
+  >>> service.getStatus(jobid)
+  'error'
+
+We do the same again to see if the same thing happens again. This test is
+necessary to see if the internal runCount in the task service is reset.
+
+  >>> io.seek(0)
+  >>> jobid = service.add(u'exception')
+  >>> service.getStatus(jobid)
+  'queued'
+  >>> import transaction
+  >>> transaction.commit()
+  >>> service.startProcessing()
+  >>> transaction.commit()
+  >>> sleep(1.5)
+  >>> service.stopProcessing()
+  >>> transaction.commit()
+
+We got log entries with the tracebacks of the division error.
+
+  >>> logvalue = io.getvalue()
+  >>> print logvalue
+  Caught a generic exception, preventing thread from crashing
+  integer division or modulo by zero
+  Traceback (most recent call last):
+  ...
+  ZeroDivisionError: integer division or modulo by zero
+  <BLANKLINE>
+
+We had 3 retries, but every error is reported twice, once by the processor and
+once from by the task service.
+
+  >>> logvalue.count('ZeroDivisionError')
+  6
+
+The job status is set to 'error'.
+
+  >>> service.getStatus(jobid)
+  'error'
+
+
+Clenaup
+-------
+
+Allow the threads to exit:
+
+  >>> sleep(0.2)

Modified: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/configure.zcml
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/configure.zcml	2010-10-11 13:55:26 UTC (rev 117453)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/configure.zcml	2010-10-11 14:27:04 UTC (rev 117454)
@@ -1,60 +1,17 @@
 <configure
-    xmlns="http://namespaces.zope.org/browser"
-    xmlns:zope="http://namespaces.zope.org/zope">
+    xmlns:browser="http://namespaces.zope.org/browser"
+    xmlns="http://namespaces.zope.org/zope">
 
-  <resourceDirectory
-      name="lovely-remotetask-icons"
-      directory="icons"
-      />
-
-  <addMenuItem
-      class="..service.TaskService"
-      title="Remote Task Service"
-      description="A Remote Task Service"
-      permission="zope.ManageContent"
-      />
-
-  <page
+  <browser:page
       name="jobs.html"
-      for="..interfaces.ITaskService"
+      for="z3c.taskqueue.interfaces.ITaskService"
       class=".service.JobsOverview"
       permission="zope.ManageContent"
-      menu="zmi_views" title="Jobs"
       />
 
-  <page
-      name="detail"
-      for="..interfaces.IJob"
-      permission="zope.ManageContent"
-      class=".job.JobDetail"
-      />
-
-  <page
-      name="detail"
-      for="..interfaces.ICronJob"
-      permission="zope.Public"
-      class=".job.CronJobDetail"
-      />
-
-  <page
-      name="editjob"
-      for="..interfaces.ICronJob"
-      permission="zope.ManageContent"
-      class=".job.CronJobEdit"
-      menu="zmi_views" title="edit"
-      />
-
-  <page
-      name="addcronjob.html"
-      for="..interfaces.ITaskService"
-      class=".job.AddCronJob"
-      permission="zope.ManageContent"
-      menu="zmi_views" title="add cron"
-      />
-
   <!-- traverser for the site -->
-  <zope:view
-      for="..interfaces.ITaskService"
+  <view
+      for="z3c.taskqueue.interfaces.ITaskService"
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       provides="zope.publisher.interfaces.browser.IBrowserPublisher"
       factory=".service.ServiceJobTraverser"

Modified: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/service.py
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/service.py	2010-10-11 13:55:26 UTC (rev 117453)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/browser/service.py	2010-10-11 14:27:04 UTC (rev 117454)
@@ -38,15 +38,16 @@
 from zope.app.pagetemplate import ViewPageTemplateFile
 from zope.app.container.contained import contained
 
-from zc.table import column, table
-from zc.table.interfaces import ISortableColumn
-from lovely.remotetask import interfaces
+from z3c.table import column, table
+from z3c.table.interfaces import IColumn as ISortableColumn
+from z3c.taskqueue import interfaces
 
 SORTED_ON_KEY = 'lovely.remotetask.service.table.sorted-on'
 
 
 from zope.interface.common.mapping import IItemMapping
 
+
 class IBatch(IItemMapping):
     """A Batch represents a sub-list of the full enumeration.
 
@@ -104,9 +105,9 @@
             raise IndexError('start index key out of range')
         self.size = size
         self.trueSize = size
-        if start+size >= len(list):
-            self.trueSize = len(list)-start
-        self.end = start+self.trueSize-1
+        if start + size >= len(list):
+            self.trueSize = len(list) - start
+        self.end = start + self.trueSize - 1
 
     def __len__(self):
         return self.trueSize
@@ -114,10 +115,10 @@
     def __getitem__(self, key):
         if key >= self.trueSize:
             raise IndexError('batch index out of range')
-        return self.list[self.start+key]
+        return self.list[self.start + key]
 
     def __iter__(self):
-        return iter(self.list[self.start:self.end+1])
+        return iter(self.list[self.start:self.end + 1])
 
     def __contains__(self, item):
         return item in self.__iter__()
@@ -144,10 +145,10 @@
         return len(self.list)
 
     def startNumber(self):
-        return self.start+1
+        return self.start + 1
 
     def endNumber(self):
-        return self.end+1
+        return self.end + 1
 
 
 class CheckboxColumn(column.Column):
@@ -155,7 +156,7 @@
 
     def renderCell(self, item, formatter):
         widget = (u'<input type="checkbox" name="jobs:list" value="%i">')
-        return widget %item.id
+        return widget % item.id
 
 
 class TaskNameColumn(column.Column):
@@ -167,7 +168,7 @@
                                                 name='editjob')
         if view:
             url = absoluteURL(formatter.context, formatter.request)
-            return '<a href="%s/%s/editjob">%s</a>'% (
+            return '<a href="%s/%s/editjob">%s</a>' % (
                                                 url, item.id, item.task)
         else:
             return item.task
@@ -178,14 +179,14 @@
 
     def renderCell(self, item, formatter):
         view = zope.component.queryMultiAdapter((item, formatter.request),
-                                              name='%s_detail'% item.task)
+                                              name='%s_detail' % item.task)
         if view is None:
             view = zope.component.getMultiAdapter((item, formatter.request),
                                                   name='detail')
         return view()
 
 
-class StatusColumn(column.GetterColumn):
+class StatusColumn(column.Column):
     zope.interface.implements(ISortableColumn)
 
     def renderCell(self, item, formatter):
@@ -197,7 +198,7 @@
         return self.getter(item, formatter)
 
 
-class DatetimeColumn(column.GetterColumn):
+class DatetimeColumn(column.Column):
     zope.interface.implements(ISortableColumn)
 
     def renderCell(self, item, formatter):
@@ -209,11 +210,10 @@
     def getSortKey(self, item, formatter):
         return self.getter(item, formatter)
 
-class ListFormatter(table.SortingFormatterMixin,
-    table.AlternatingRowFormatter):
+
+class ListFormatter(table.Table):
     """Provides a width for each column."""
 
-    sortedHeaderTemplate = ViewPageTemplateFile('table_header.pt')
     widths = None
     columnCSS = None
     sortable = False
@@ -274,14 +274,13 @@
         width = ''
         if self.widths:
             idx = list(self.visible_columns).index(column)
-            width = ' width="%i"' %self.widths[idx]
+            width = ' width="%i"' % self.widths[idx]
         klass = self.cssClasses.get('tr', '')
         if column.name in self.columnCSS:
             klass += klass and ' ' or '' + self.columnCSS[column.name]
         return '      <th%s class=%s>\n        %s\n      </th>\n' % (
             width, quoteattr(klass), self.getHeader(column))
 
-
     def renderCell(self, item, column):
         klass = self.cssClasses.get('tr', '')
         if column.name in self.columnCSS:
@@ -300,24 +299,24 @@
     status = None
 
     columns = (
-        CheckboxColumn(u'Sel'),
-        column.GetterColumn(u'Id', lambda x, f: str(x.id), name='id'),
-        TaskNameColumn(u'Task', name='task'),
-        StatusColumn(u'Status', lambda x, f: x.status, name='status'),
-        JobDetailColumn(u'Detail', name='detail'),
-        DatetimeColumn(u'Creation',
-                       lambda x, f: x.created, name='created'),
-        DatetimeColumn(u'Start',
-                       lambda x, f: x.started, name='start'),
-        DatetimeColumn(u'End',
-                       lambda x, f: x.completed, name='end'),
+#        CheckboxColumn(u'Sel'),
+#        column.Column(u'Id', lambda x, f: str(x.id), name='id'),
+#        TaskNameColumn(u'Task', name='task'),
+#        StatusColumn(u'Status', lambda x, f: x.status, name='status'),
+#        JobDetailColumn(u'Detail', name='detail'),
+#        DatetimeColumn(u'Creation',
+#                       lambda x, f: x.created, name='created'),
+#        DatetimeColumn(u'Start',
+#                       lambda x, f: x.started, name='start'),
+#        DatetimeColumn(u'End',
+#                       lambda x, f: x.completed, name='end'),
         )
 
     def table(self):
         formatter = ListFormatter(
             self.context, self.request, self.jobs(),
             prefix='zc.table', columns=self.columns)
-        formatter.widths=[25, 50, 100, 75, 250, 120, 120, 120]
+        formatter.widths = [25, 50, 100, 75, 250, 120, 120, 120]
         formatter.cssClasses['table'] = 'list'
         formatter.columnCSS['id'] = 'tableId'
         formatter.columnCSS['task'] = 'tableTask'
@@ -386,7 +385,7 @@
         elif 'CANCEL_ALL' in self.request:
             jobs = list(self.context.jobs.keys())
             for index, job in enumerate(jobs):
-                if index%100 == 99:
+                if index % 100 == 99:
                     transaction.commit()
                 self.context.cancel(job)
             self.status = u'All jobs cancelled'
@@ -397,6 +396,7 @@
 
 from zope.publisher.interfaces import IPublishTraverse
 
+
 class ServiceJobTraverser(object):
     zope.interface.implements(IPublishTraverse)
 
@@ -416,4 +416,3 @@
         if view is not None:
             return view
         raise NotFound(self.context, name, request)
-

Added: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/configure.zcml
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/configure.zcml	                        (rev 0)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/configure.zcml	2010-10-11 14:27:04 UTC (rev 117454)
@@ -0,0 +1,7 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    xmlns:zope="http://namespaces.zope.org/zope">
+
+  <include package="z3c.taskqueue_ui.browser" />
+
+</configure>

Modified: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/ftesting.zcml
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/ftesting.zcml	2010-10-11 13:55:26 UTC (rev 117453)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/ftesting.zcml	2010-10-11 14:27:04 UTC (rev 117454)
@@ -16,12 +16,10 @@
 
   <include package="zope.login" />
   <include package="zope.app.authentication" />
-  <include package="zope.app.session" />
-  <include package="lovely.remotetask" />
-  <include package="zope.app.xmlrpcintrospection" />
 
+  <include package="." />
   <utility
-      factory="lovely.remotetask.testing.ExceptionTask"
+      factory="z3c.taskqueue.testing.ExceptionTask"
       name="exception" />
 
   <securityPolicy

Added: Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/tests.py
===================================================================
--- Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/tests.py	                        (rev 0)
+++ Sandbox/gotcha/z3c.taskqueue_ui/trunk/src/z3c/taskqueue_ui/tests.py	2010-10-11 14:27:04 UTC (rev 117454)
@@ -0,0 +1,29 @@
+__docformat__ = 'restructuredtext'
+import unittest
+from zope.app.testing import functional
+import os
+import random
+
+zcml = os.path.join(os.path.dirname(__file__), 'ftesting.zcml')
+
+RemotetaskLayer = None #to please pyflakes
+functional.defineLayer('RemotetaskLayer',
+    zcml, allow_teardown=True)
+
+
+def setUp(test):
+    random.seed(27)
+
+
+def tearDown(test):
+    random.seed()
+
+
+def test_suite():
+    suite = functional.FunctionalDocFileSuite(
+        os.sep.join(('browser', 'README.txt')),
+        setUp=setUp,
+        tearDown=tearDown,
+    )
+    suite.layer = RemotetaskLayer
+    return unittest.TestSuite((suite, ))



More information about the checkins mailing list