I have a dtml-document that displays some information given a database key as an argument in the request. I call the document as "/document?id=239". I created a script to receive similar requests: "/docscript/239". This way I could get the key from the traverse_subpath, add 'id' to the request and forward control on to the original dtml-document. If I call the document as "/document?id=239" things display properly. If I call the script, all the basic content on the resulting page is right, but the style sheet and graphics aren't picked up in the process. Both the script and the dtml-document are in the same folder. The script is below. Any ideas anyone? request = container.REQUEST if len(traverse_subpath) > 0 : request.set('id', traverse_subpath[0]) return context['document'](container, request) Thanks, Kevin
Kevin Carlson wrote:
I have a dtml-document that displays some information given a database key as an argument in the request.
Yuck! At the very least that should be a DTML method. But DTML's horrible calling arguments are probably tripping you up to. I'd move to ZPT...
request = container.REQUEST if len(traverse_subpath) > 0 : request.set('id', traverse_subpath[0])
return context['document'](container, request)
Try context.document(None,_) (you'll need to bind _ to the namespace on the bindings tab) Of course, if document was a ZPT, it's just be: context.document() ...and work ;-) cheers, Chris
Turns out that this was due to the stylesheet being accessed via a relative path. Once I altered the source to have an absolute path, everything worked fine. Kevin Kevin Carlson wrote:
I have a dtml-document that displays some information given a database key as an argument in the request. I call the document as "/document?id=239".
I created a script to receive similar requests: "/docscript/239". This way I could get the key from the traverse_subpath, add 'id' to the request and forward control on to the original dtml-document.
If I call the document as "/document?id=239" things display properly. If I call the script, all the basic content on the resulting page is right, but the style sheet and graphics aren't picked up in the process. Both the script and the dtml-document are in the same folder. The script is below. Any ideas anyone?
request = container.REQUEST if len(traverse_subpath) > 0 : request.set('id', traverse_subpath[0])
return context['document'](container, request)
Thanks,
Kevin
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Kevin, You might want to be cautious about using 'id' as a variable name as it has special meanings in Zope and might be confused. On Sun, 16 Feb 2003, Kevin Carlson wrote:
Turns out that this was due to the stylesheet being accessed via a relative path. Once I altered the source to have an absolute path, everything worked fine.
Kevin
Kevin Carlson wrote:
I have a dtml-document that displays some information given a database key as an argument in the request. I call the document as "/document?id=239".
I created a script to receive similar requests: "/docscript/239". This way I could get the key from the traverse_subpath, add 'id' to the request and forward control on to the original dtml-document.
If I call the document as "/document?id=239" things display properly. If I call the script, all the basic content on the resulting page is right, but the style sheet and graphics aren't picked up in the process. Both the script and the dtml-document are in the same folder. The script is below. Any ideas anyone?
request = container.REQUEST if len(traverse_subpath) > 0 : request.set('id', traverse_subpath[0])
return context['document'](container, request)
Thanks,
Kevin
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Kevin Carlson wrote at 2003-2-14 17:04 -0500:
I have a dtml-document that displays some information given a database key as an argument in the request. I call the document as "/document?id=239".
I created a script to receive similar requests: "/docscript/239". This way I could get the key from the traverse_subpath, add 'id' to the request and forward control on to the original dtml-document.
If I call the document as "/document?id=239" things display properly. If I call the script, all the basic content on the resulting page is right, but the style sheet and graphics aren't picked up in the process. Both the script and the dtml-document are in the same folder. The script is below. Any ideas anyone?
That's almost surely an effect of relative URL references. As a general rule, avoid relative URL references to static content because with high probability that makes caching much more difficult. In your case, the relative URL references go through "document" which blocks Zope's normal acquisition because the remaining URL path is put into "traverse_subpath" and not looks up normally. Access them via absolute URL's and your problem will go away. If you really do not want to follow this advice, you must teach your script to deliver the correct objects when they are referenced in the "traverse_subpath". Dieter
participants (4)
-
Chris Withers -
Dennis Allison -
Dieter Maurer -
Kevin Carlson