[Twisted-Python] Woven using wrong model adapter

Christopher Armstrong radix at twistedmatrix.com
Mon May 26 19:37:07 MDT 2003


On 2003.05.26 21:13, Kevin Turner wrote:
> I have:
> 
> components.registerAdapter(model.ObjectWrapper,
>                            interests.InterestChangeReport,
>                            wovenInterfaces.IModel)
> 
> class Page(page.Page):
>     def wmfactory_report(self, request):
>         if sometimes:
>             return deferredInterestChangeReport()
>         else:
>             return ''

...
 
> So why does woven persist in using the StringModel adapter in this case,
> and how can I get it to stop?

IIRC, A workaround is to 1) put the conditional in a special wvfactory rather 
than/in addition to your wmfactory, or 2) call self.invalidateCache() every 
time the result of the conditional changes (or just on every request, if you
don't care)

> 
> Don't know if this is related or not, but the log shows messages like:
> "Warning: There was no parent for node [...]; node not mutated."  Is
> that something I should be concerned about?

dunno

-- 
 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/




More information about the Twisted-Python mailing list