[Twisted-web] On Flatteners and Adapters

Pedro Sanchez psanchez at nortel.com
Sat Aug 20 06:37:44 MDT 2005



Phil Frost wrote:
> On Fri, Aug 19, 2005 at 07:14:34PM -0400, Pedro Sanchez wrote:
> 
>>Hello,
>>
>>I'm trying to implement a menu with the attached code, but it fails with
>>the following error:
>>
>>exceptions.NotImplementedError: There is no flattener function
>>registered for object <Menu object at 0xb76dd42c> of type <class
>>'Menu'>.
>>
>>...
>>
>>I don't understand why it complains about flatteners not defined. Isn't
>>that covered by the registered adapters? I'd appreciate any help.
>>
>>Thank you,
>>
>>-- 
>>Pedro
> 
> 
> It used to work like that. A while ago, a change was made to how
> flatteners are registered; nevow.flat.registerFlattener is the new way
> to do it:
> 
> from nevow import flat
> 
> class Bleh(object):
>     pass
> 
> def flattenBleh(original, context):
>     return 'a bleh thing'
> 
> flat.registerFlattener(flattenBleh, Bleh)
> 

Thanks,

I will check this. However, the recipe in the Python cookbook website 
works well and it doesn't use the interface you mention. So my code 
should in theory work, provided I fix whatever is broken :)

-- 
Pedro

> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
> 



More information about the Twisted-web mailing list