Aha! All becomes clear.
If there is a better way, I am certainly willing to use it.
Yep, it's much simpler too :)
Although locateChild() is the "official" API for URL traversal, rend.Page adds some more convenient ways of specifying children. The one you probably want is so define a child_images attribute on your root page's class:
from twisted.application import internet, service from twisted.web import static from nevow import appserver from nevow import rend from nevow import static class RootPage(rend.Page): # Mount the 'images' directory at the '/images' URl child_images = static.File('images') docFactory = rend.htmlstr( ''' <html> <body> <img src="/images/TwistedLogoFull.png" /> <p>Blah, blah, blah</p> </body> </html> ''' ) application = service.Application('static') webServer = internet.TCPServer( 8000, appserver.NevowSite(RootPage())) webServer.setServiceParent(application)
Ok. Cool. That looks nice.
With that example, and unpatched nevow, I still get an error when trying to browse to http://localhost/images (note, no trailing slash) The error is the same as in my last post ...
File "/usr/local/lib/python2.3/site-packages/twisted/python/filepath.py", line 138, in open return open(self.path, mode+'b') exceptions.IOError: [Errno 21] Is a directory
Also... trying to get the Nevow module from anonymous cvs is giving me an error:
$cvs -d:pserver:anon@divmod.org:/cvs co Nevow cvs server: cannot find module `Nevow' - ignored cvs [checkout aborted]: cannot expand modules
Thank you for your time.
_________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
On Mon, 2004-04-05 at 23:43, Lee Harr wrote:
Aha! All becomes clear.
If there is a better way, I am certainly willing to use it.
Yep, it's much simpler too :)
Although locateChild() is the "official" API for URL traversal, rend.Page adds some more convenient ways of specifying children. The one you probably want is so define a child_images attribute on your root page's class:
from twisted.application import internet, service from twisted.web import static from nevow import appserver from nevow import rend from nevow import static class RootPage(rend.Page): # Mount the 'images' directory at the '/images' URl child_images = static.File('images') docFactory = rend.htmlstr( ''' <html> <body> <img src="/images/TwistedLogoFull.png" /> <p>Blah, blah, blah</p> </body> </html> ''' ) application = service.Application('static') webServer = internet.TCPServer( 8000, appserver.NevowSite(RootPage())) webServer.setServiceParent(application)
Ok. Cool. That looks nice.
With that example, and unpatched nevow, I still get an error when trying to browse to http://localhost/images (note, no trailing slash) The error is the same as in my last post ...
File "/usr/local/lib/python2.3/site-packages/twisted/python/filepath.py", line 138, in open return open(self.path, mode+'b') exceptions.IOError: [Errno 21] Is a directory
Hmm, that's strange. Here /images is redirected to /images/ and I get a directory list as expected. Could you paste the entire stack trace please.
Also... trying to get the Nevow module from anonymous cvs is giving me an error:
$cvs -d:pserver:anon@divmod.org:/cvs co Nevow cvs server: cannot find module `Nevow' - ignored cvs [checkout aborted]: cannot expand modules
Everything at divmod recently moved to subversion. Use the following:
svn co svn://divmod.org/svn/Nevow/trunk Nevow
Cheers, Matt
On Apr 5, 2004, at 6:43 PM, Lee Harr wrote:
Also... trying to get the Nevow module from anonymous cvs is giving me an error:
$cvs -d:pserver:anon@divmod.org:/cvs co Nevow cvs server: cannot find module `Nevow' - ignored cvs [checkout aborted]: cannot expand modules
Nevow is now in svn:
svn://divmod.org/svn/Nevow/trunk
Sorry about the lack of notice about this. Hopefully we should have better organized information and more timely announcements soon.
dp