Hi there,

I'm trying to use zc.table to format the output of one of my forms. it seems to work ok for the unsorted formatter, but not for the StandalonSortFormatter. Here is the code that works with plain formatter:

columns = (
    GetterColumn(name=u'dn', title=u'Distinguished Name', getter=lambda i, f: 
i.dn, subsort=True),
    GetterColumn(name=u'displayName', title=u'Name', getter=lambda i, f: 
i.displayName, subsort=True),
    GetterColumn(name=u'mail', title=u'Email Address', getter=lambda i, f: 
i.mail, subsort=True),

class LDAPFilterForm(form.Form):
    form_fields = form.Fields(interfaces.ILDAPFilter)

    def handle_search_action(self, action, data):
        search = interfaces.ILDAPSearch(self.context, None)
        results = search.search(data['filter'])
        self.table = table.Formatter(self.context, self.request, list(results), 
        return self.table()

but when I change the Formatter to StandaloneSortFormatter, I still get the same html output. I have tried adding in this from the zc.table readme:

for c in columns:
    directlyProvides(c, zc.table.interfaces.ISortableColumn)

def dummyResource(request):
    return lambda:'/@@/zc.table'

provideAdapter(dummyResource, name='zc.table')

But then I get the following traceback:

2006-03-14T16:34:32 ERROR SiteError http://localhost:8080/@@/zc.table
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 135, 
in publish
    object = request.traverse(object)
  File "/usr/lib/python2.4/site-packages/zope/publisher/browser.py", line 500, 
in traverse
    ob = super(BrowserRequest, self).traverse(object)
  File "/usr/lib/python2.4/site-packages/zope/publisher/http.py", line 451, in 
    ob = super(HTTPRequest, self).traverse(object)
  File "/usr/lib/python2.4/site-packages/zope/publisher/base.py", line 289, in 
    subobject = publication.traverseName(
line 56, in traverseName
    ob2 = ob.publishTraverse(request, nm)
line 40, in publishTraverse
    locate(resource, sm, name)
  File "/usr/lib/python2.4/site-packages/zope/app/location/location.py", line 
72, in locate
    object.__name__ = name
TypeError: func_name must be set to a string object
func_name must be set to a string object
-> object.__name__ = name

Using the debugger I can see:

(Pdb) name

Any ideas? I'm stumped.


Zope3-users mailing list

Reply via email to