nevow CannotAdapt error
I'm trying to run a simple nevow test: from nevow.renderer import Renderer class MyRenderer(Renderer): document = """<xml>test</xml>""" m = MyRenderer() But get the following traceback? Traceback (most recent call last): File "c:\data\htdocs\test.py", line 9, in ? m = MyRenderer() File "C:\PYTHON23\Lib\site-packages\nevow\renderer.py", line 152, in __init__ self.doc = self.precompile() File "C:\PYTHON23\Lib\site-packages\nevow\renderer.py", line 162, in precompile _documents[klsnm] = rv = flatten(ISerializable(self.document).serialize(context, None)) File "C:\PYTHON23\Lib\site-packages\twisted\python\components.py", line 77, in __call__ raise CannotAdapt("%s cannot be adapted to %s." % CannotAdapt: <xml>test</xml> cannot be adapted to <class 'nevow.iwoven.ISerializable'>.
On Dec 11, 2003, at 11:24 PM, Kevin Howe wrote:
I'm trying to run a simple nevow test:
from nevow.renderer import Renderer class MyRenderer(Renderer): document = """<xml>test</xml>""" m = MyRenderer()
But get the following traceback?
<snip cannot adapt> Are you using cvs? If you use CVS HEAD, you might find that this problem goes away. Otherwise, you'll need to import atop.regadapt and call justDoIt to register the adapters. Also, note that your document is a simple python string, but has xml in it. Nevow quotes normal python strings, so if you want it to go through as straight xml, you should wrap it in a stan.xml object first. dp
Some of the confusion is probably because I had it incorrect in the doc. I updated it yesterday to say something like: document = xml("some html") instead of: document = "<xml>some html</xml>" On Thu, 11 Dec 2003 23:43:31 -0500, "Donovan Preston" <dp@divmod.org> said:
On Dec 11, 2003, at 11:24 PM, Kevin Howe wrote:
I'm trying to run a simple nevow test:
from nevow.renderer import Renderer class MyRenderer(Renderer): document = """<xml>test</xml>""" m = MyRenderer()
But get the following traceback?
<snip cannot adapt>
Are you using cvs? If you use CVS HEAD, you might find that this problem goes away. Otherwise, you'll need to import atop.regadapt and call justDoIt to register the adapters.
Also, note that your document is a simple python string, but has xml in it. Nevow quotes normal python strings, so if you want it to go through as straight xml, you should wrap it in a stan.xml object first.
dp
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
* Donovan Preston <dp@divmod.org> [2003-12-12 02:57]: [...]
But get the following traceback?
<snip cannot adapt>
Are you using cvs? If you use CVS HEAD, you might find that this problem goes away. Otherwise, you'll need to import atop.regadapt and call justDoIt to register the adapters. [...]
It would be nice to have a Requirements note for nevow somewhere on http://stewstuff.com/doc/nevow.xhtml or perhaps a README on the CVS nevow dir, so newbies can check it out more easily. Best regards, -- rnc <nieder at mail dot ru>
On Dec 17, 2003, at 2:36 PM, Ricardo Niederberger Cabral wrote:
It would be nice to have a Requirements note for nevow somewhere on http://stewstuff.com/doc/nevow.xhtml or perhaps a README on the CVS nevow dir, so newbies can check it out more easily.
I have been planning on packaging a standalone distro of nevow. Radix has kindly offered to help in this effort, as I know nothing about distutils or any of the issues related to actually producing usable tarballs of python software. I'd like to do this sometime within the next few weeks. One of the things I have been thinking about doing before doing a standalone distribution is removing the dependency on twisted. I have been contemplating using PyProtocols for the adaption machinery, and writing a simple CGI renderer to replace the ones that are twisted-web aware. However, while I want to pursue this goal eventually to ensure that nevow has as few dependency abstraction violations as possible, it probably won't happen right away, so I probably shouldn't do it for the first standalone release. Radix, what are your thoughts about timing? dp
Donovan Preston wrote:
One of the things I have been thinking about doing before doing a standalone distribution is removing the dependency on twisted. I have been contemplating using PyProtocols for the adaption machinery, and writing a simple CGI renderer to replace the ones that are twisted-web aware. However, while I want to pursue this goal eventually to ensure that nevow has as few dependency abstraction violations as possible, it probably won't happen right away, so I probably shouldn't do it for the first standalone release.
As I might have mumbled about before, I think it's wasted effort to bother removing dependency on Twisted. You can still do a CGI interface without getting rid of the Twisted dependency altogether, and if people can install Nevow in their CGI environments, they can also install Twisted.
Radix, what are your thoughts about timing?
DP and I talked about this on IRC. Basically, we need:: * Move regadapt into Twisted (twisted.python) * Modify the Quotient release process such that it includes CVS HEAD of Nevow for every Quotient release. * Put Nevow into its own CVS module As soon as these can happen, Nevow can have a standalone release. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com/
participants (5)
-
Christopher Armstrong
-
Donovan Preston
-
Justin Johnson
-
Kevin Howe
-
Ricardo Niederberger Cabral