hi! i have a very simple problem: i have a dtml method called reg which should finalize a registration ... so i would like to have such urls: http://some.site.com/reg/b6ac3fe9 if reg is a dtml method, then entering this url gives me a not found error ... ok cool . lets do a python script, and traverse_subpath. subpath doesnt exist (but its binded!!) so lets use traverse_subpath ... but now i am in a python script, i dont want to output html from here, i just want to check a row in the database! (outputting html gives me nice < stuff - this is great too!) i searched for traverse_subpath, and didnt find something of use. just a traversable dtml document product. ARGH! please! i dont want to install products or make some magic with python scripts interacting with dtml! i started using zope because of its simplicity, i dont know why isnt there a simple way of doing this?? or perhaps there is but i cannot find it? i am very desperated :) all i need is a <dtml-if> checking against the part after 'reg' .. (b6ac3fe9 here) ... i dont want python scripts for a single if ... why do you zope developers think that traverse_subpath should be used in a pythn script only? how can i achieve the same in dtml? why isnt http://something/reg/foo/bar working as dtml, but is working as a python script? zope is cool, i love smoking too, but sometimes it can be so hairy ... damn .. :) thanks, -jonatan.
I think what you want is to generate a URL like so: http://some.site.com/reg?my_id=b6ac3fe9 And then within reg you can do: <dtml-if my_id> <dtml-call "do_something(my_id)"> </dtml-if> Does that help? If not, could you be a little more specific about what you're trying to accomplish? Dylan At 02:01 PM 11/22/2002, jonatan wrote:
hi!
i have a very simple problem: i have a dtml method called reg which should finalize a registration ... so i would like to have such urls: http://some.site.com/reg/b6ac3fe9
if reg is a dtml method, then entering this url gives me a not found error ... ok cool .
lets do a python script, and traverse_subpath. subpath doesnt exist (but its binded!!) so lets use traverse_subpath ...
but now i am in a python script, i dont want to output html from here, i just want to check a row in the database!
(outputting html gives me nice < stuff - this is great too!)
i searched for traverse_subpath, and didnt find something of use. just a traversable dtml document product.
ARGH!
please! i dont want to install products or make some magic with python scripts interacting with dtml! i started using zope because of its simplicity, i dont know why isnt there a simple way of doing this??
or perhaps there is but i cannot find it?
i am very desperated :)
all i need is a <dtml-if> checking against the part after 'reg' .. (b6ac3fe9 here) ... i dont want python scripts for a single if ... why do you zope developers think that traverse_subpath should be used in a pythn script only? how can i achieve the same in dtml?
why isnt http://something/reg/foo/bar working as dtml, but is working as a python script?
zope is cool, i love smoking too, but sometimes it can be so hairy ... damn .. :)
thanks,
-jonatan.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
hi! i would like to make nice looking url's .. what you said would help me, but i'd like to have an url like http://something.com/reg/b6ac3fe9 jonatan On Fri, 2002-11-22 at 23:46, Dylan Reinhardt wrote:
I think what you want is to generate a URL like so:
http://some.site.com/reg?my_id=b6ac3fe9
And then within reg you can do:
<dtml-if my_id> <dtml-call "do_something(my_id)"> </dtml-if>
Does that help? If not, could you be a little more specific about what you're trying to accomplish?
Dylan
At 02:01 PM 11/22/2002, jonatan wrote:
hi!
i have a very simple problem: i have a dtml method called reg which should finalize a registration ... so i would like to have such urls: http://some.site.com/reg/b6ac3fe9
if reg is a dtml method, then entering this url gives me a not found error ... ok cool .
lets do a python script, and traverse_subpath. subpath doesnt exist (but its binded!!) so lets use traverse_subpath ...
but now i am in a python script, i dont want to output html from here, i just want to check a row in the database!
(outputting html gives me nice < stuff - this is great too!)
i searched for traverse_subpath, and didnt find something of use. just a traversable dtml document product.
ARGH!
please! i dont want to install products or make some magic with python scripts interacting with dtml! i started using zope because of its simplicity, i dont know why isnt there a simple way of doing this??
or perhaps there is but i cannot find it?
i am very desperated :)
all i need is a <dtml-if> checking against the part after 'reg' .. (b6ac3fe9 here) ... i dont want python scripts for a single if ... why do you zope developers think that traverse_subpath should be used in a pythn script only? how can i achieve the same in dtml?
why isnt http://something/reg/foo/bar working as dtml, but is working as a python script?
zope is cool, i love smoking too, but sometimes it can be so hairy ... damn .. :)
thanks,
-jonatan.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) -- jonatan <jonatanpelikan@freemail.hu>
I don't think there's a "keep-it-simple" answer that will let you use http://something.com/reg/b6ac3fe9 the way you want to.. In Zope, the URL somesite/foo/bar means "use bar in the context of foo," _not_ "pass bar to foo" In typical usage, bar is a _method_ of foo or is _contained by_ foo. Since what you want to do is to pass an arbitrary value to a specific object, the very most straightforward ways would be to roll them up in the URL, use POST, or put the value in a cookie. Thus, you can try: <form action=reg method=post> <input type=hidden name=my_id value=<dtml-var some_value>> <input type=submit value="Finish Registration"> </form> Or: <dtml-call "RESPONSE.setCookie('my_id', some_value)"> Either one will allow you can catch my_id in reg thus: <dtml-var my_id> and your URL will be the ultra-nice http://something.com/reg That's about it for uncomplicated solutions. You *could* write a registration product that trapped unbound methods and used them as passed values... but not only did you say you didn't want to write a product, I'm not sure it would be such a great idea to do something like that anyway. :-) HTH, Dylan At 03:37 PM 11/22/2002, jonatan wrote:
hi!
i would like to make nice looking url's .. what you said would help me, but i'd like to have an url like http://something.com/reg/b6ac3fe9
jonatan
On Fri, 2002-11-22 at 23:46, Dylan Reinhardt wrote:
I think what you want is to generate a URL like so:
http://some.site.com/reg?my_id=b6ac3fe9
And then within reg you can do:
<dtml-if my_id> <dtml-call "do_something(my_id)"> </dtml-if>
Does that help? If not, could you be a little more specific about what you're trying to accomplish?
Dylan
At 02:01 PM 11/22/2002, jonatan wrote:
hi!
i have a very simple problem: i have a dtml method called reg which should finalize a registration ... so i would like to have such urls: http://some.site.com/reg/b6ac3fe9
if reg is a dtml method, then entering this url gives me a not found error ... ok cool .
lets do a python script, and traverse_subpath. subpath doesnt exist (but its binded!!) so lets use traverse_subpath ...
but now i am in a python script, i dont want to output html from here, i just want to check a row in the database!
(outputting html gives me nice < stuff - this is great too!)
i searched for traverse_subpath, and didnt find something of use. just a traversable dtml document product.
ARGH!
please! i dont want to install products or make some magic with python scripts interacting with dtml! i started using zope because of its simplicity, i dont know why isnt there a simple way of doing this??
or perhaps there is but i cannot find it?
i am very desperated :)
all i need is a <dtml-if> checking against the part after 'reg' .. (b6ac3fe9 here) ... i dont want python scripts for a single if ... why do you zope developers think that traverse_subpath should be used in a pythn script only? how can i achieve the same in dtml?
why isnt http://something/reg/foo/bar working as dtml, but is working as a python script?
zope is cool, i love smoking too, but sometimes it can be so hairy ... damn .. :)
thanks,
-jonatan.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) -- jonatan <jonatanpelikan@freemail.hu>
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of jonatan Sent: Friday, November 22, 2002 3:38 PM To: Dylan Reinhardt Cc: zope@zope.org Subject: Re: [Zope] subpath in dtml?
hi!
i would like to make nice looking url's .. what you said would help me, but i'd like to have an url like http://something.com/reg/b6ac3fe9
jonatan
Create a python script object named 'reg'. The rest of the path (b6ac3fe9 in this case) will be sitting in the variable 'traverse_subpath[0]'.
Hi Jonatan, just use the traverse_subpath in your Python script as you need to. Thats pretty fine. Then output your HTML using a template. If its a page template you simply call return context.yourOutputTemplate(context) or if you want to pass parameters, call is like so: return context.yourOutputTemplate({'foo':1,'bar':5}) so you can find foo and bar in the options namespace. DTML call is similar and scould be mentioned in the list archive several times. Making nice URLs using traverse_subpath is a good thing (tm) :-) HTH Tino Wildenhain --On Freitag, 22. November 2002 23:01 +0100 jonatan <jonatanpelikan@freemail.hu> wrote
hi!
i have a very simple problem: i have a dtml method called reg which should finalize a registration ... so i would like to have such urls: http://some.site.com/reg/b6ac3fe9
if reg is a dtml method, then entering this url gives me a not found error ... ok cool .
lets do a python script, and traverse_subpath. subpath doesnt exist (but its binded!!) so lets use traverse_subpath ...
but now i am in a python script, i dont want to output html from here, i just want to check a row in the database!
(outputting html gives me nice < stuff - this is great too!)
i searched for traverse_subpath, and didnt find something of use. just a traversable dtml document product.
ARGH!
please! i dont want to install products or make some magic with python scripts interacting with dtml! i started using zope because of its simplicity, i dont know why isnt there a simple way of doing this??
or perhaps there is but i cannot find it?
i am very desperated :)
all i need is a <dtml-if> checking against the part after 'reg' .. (b6ac3fe9 here) ... i dont want python scripts for a single if ... why do you zope developers think that traverse_subpath should be used in a pythn script only? how can i achieve the same in dtml?
why isnt http://something/reg/foo/bar working as dtml, but is working as a python script?
zope is cool, i love smoking too, but sometimes it can be so hairy ... damn .. :)
thanks,
-jonatan.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Sat, 2002-11-23 at 12:17, Tino Wildenhain wrote:
Hi Jonatan,
just use the traverse_subpath in your Python script as you need to. Thats pretty fine. Then output your HTML using a template. If its a page template you simply call return context.yourOutputTemplate(context)
i am doing this now. i have a python script called reg which calls reg_dtml : request = container.REQUEST return context.reg_dtml(context, request, fixreg=traverse_subpath[0]) this if fine. but now the problem is that the dtml method gets called in the context of reg, which is not good... for example the images arent coming. http://something.com/reg/image.jpg is requested instead of http://something.com/image.jpg how do i call reg_dtml with another context? (i tried context.aq_parent, context.getParentNode, but didnt succeed) thanks, - jonatan
Hi Jonatan, just fix up your DTML :-) Use site-relative paths, like /images/foo instead of just foo. Regards Tino --On Sonntag, 24. November 2002 19:20 +0100 jonatan <jonatanpelikan@freemail.hu> wrote:
On Sat, 2002-11-23 at 12:17, Tino Wildenhain wrote:
Hi Jonatan,
just use the traverse_subpath in your Python script as you need to. Thats pretty fine. Then output your HTML using a template. If its a page template you simply call return context.yourOutputTemplate(context)
i am doing this now.
i have a python script called reg which calls reg_dtml :
request = container.REQUEST return context.reg_dtml(context, request, fixreg=traverse_subpath[0])
this if fine. but now the problem is that the dtml method gets called in the context of reg, which is not good... for example the images arent coming. http://something.com/reg/image.jpg is requested instead of http://something.com/image.jpg
how do i call reg_dtml with another context?
(i tried context.aq_parent, context.getParentNode, but didnt succeed)
thanks,
- jonatan
What? Are you nuts?? No, not really, though not in this respect. I am busy with a company who actually has a dotcom, which I am bringing (converting) into Zope and I'll convert the ASP scripts into Python scripts. But, I have some time limit so I'd like to know, if there is some way to bring it in first with all the ASP stuff, and then rewrite the scripts one by one. I guess the answer is no, but I am not sure. Thanx in advance, Jurgen
Hi, --On Sonntag, 24. November 2002 21:28 +0100 Blurg <blurg@gluipzak.nl> wrote:
What? Are you nuts??
No, not really, though not in this respect.
I am busy with a company who actually has a dotcom, which I am bringing (converting) into Zope and I'll convert the ASP scripts into Python scripts.
Dont try to do this. Try to build the application with Zope using python scripts, but dont try to 1:1 adapt ASP logic into Zope. You'll end up making things harder for you then they have to.
But, I have some time limit so I'd like to know, if there is some way to bring it in first with all the ASP stuff, and then rewrite the scripts one by one.
I guess the answer is no, but I am not sure.
I'd say no, but: you might have written your scripts in Python. ASP uses Scripting host and scripting host does not only support VBScript, but also JScript and - if installed - python. If so, you could write a "wrapper" which exposes the needed API to your scripts. (Of course this would be much more work then simply rewriting the app completely) If they are in VBScript you can try to build an exotic pile of abstration layers, like calling script via web client from zope to IIS, or use scripting host from Zope->External Method->some_wierd_DCOM_action Whatever. If you manage to learn the strengts of zope, you will write the application much faster from scratch. May we learn what you want to transport to zope? May be its done already elsewhere? Regards Tino
On Sun, 24 Nov 2002, Tino Wildenhain wrote:
Hi,
Dont try to do this. Try to build the application with Zope using python scripts, but dont try to 1:1 adapt ASP logic into Zope. You'll end up making things harder for you then they have to.
It's all about the time limit. I rather convert the scripts, or either rebuilt it from scratch off course. But I thought it would be possible, would last for 30 days then or something, to have a litte more time.
But, I have some time limit so I'd like to know, if there is some way to bring it in first with all the ASP stuff, and then rewrite the scripts one by one.
I guess the answer is no, but I am not sure.
I'd say no, but: you might have written your scripts in Python. ASP uses Scripting host and scripting host does not only support VBScript, but also JScript and - if installed - python. If so, you could write a "wrapper" which exposes the needed API to your scripts. (Of course this would be much more work then simply rewriting the app completely)
If they are in VBScript you can try to build an exotic pile of abstration layers, like calling script via web client from zope to IIS, or use scripting host from Zope->External Method->some_wierd_DCOM_action
Whatever. If you manage to learn the strengts of zope, you will write the application much faster from scratch.
Yeah, okay, I'll do that. It's just that I need more time. I guess it's just easier then to do it from scratch :)
May we learn what you want to transport to zope? May be its done already elsewhere?
It's just a simple site, which I can built in Perl for a couple of days. But I am going through the Zope learning curve now, and that's why I am not that fast. I need to get better OO-glasses still :) Thinking in objects and so on. it's www.hginternational.com , a company which is selling cleaning stuff. Jurgen
Regards Tino
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Blurg, --On Sonntag, 24. November 2002 23:25 +0100 Blurg <blurg@gluipzak.nl> wrote: ...
Whatever. If you manage to learn the strengts of zope, you will write the application much faster from scratch.
Yeah, okay, I'll do that. It's just that I need more time. I guess it's just easier then to do it from scratch :)
May we learn what you want to transport to zope? May be its done already elsewhere?
It's just a simple site, which I can built in Perl for a couple of days. But I am going through the Zope learning curve now, and that's why I am not that fast. I need to get better OO-glasses still :) Thinking in objects and so on. it's www.hginternational.com , a company which is selling cleaning stuff.
This is pretty easy if you have a skilled zope person at hand. For learning its also good but if you are at the very beginning you should not work in such a time pressure. Especially if you are a beginner to OO, python _and_ Zope ;) If it must be done in 30 days which is more then you need if you are familar with zope for this site - try to hire a professional. While we are in the advicing situation: drop that old style HTML in advance to w3c standard HTML4/XHTML with CSS. This saves time too if done properly. (And get ride of the frames) Regards Tino
On Sun, Nov 24, 2002 at 11:25:05PM +0100, Blurg wrote:
It's all about the time limit. I rather convert the scripts, or either rebuilt it from scratch off course. But I thought it would be possible, would last for 30 days then or something, to have a litte more time.
Been there, done that (though it was jsp / weblogic / portal that was "converted" to zope as quickly as possible). The result was, to put it nicely, ugly. Fragile, hard to understand, and as a result, unmaintainable. If you're determined to go down this route, *plan* to throw the result away as soon as possible. --PW -- Paul Winkler http://www.slinkp.com "Welcome to Muppet Labs, where the future is made - today!"
On Sun, 2002-11-24 at 21:09, Tino Wildenhain wrote:
Hi Jonatan,
just fix up your DTML :-) Use site-relative paths, like /images/foo instead of just foo.
yes, absolute_url() would be nice. how do i say header.jpg.absolute_url() ? zope says header does not exist .. yeah, it really doesnt. but i need header.jpg :) ARGH !!! - jonatan
jonatan wrote:
On Sun, 2002-11-24 at 21:09, Tino Wildenhain wrote:
Hi Jonatan,
just fix up your DTML :-) Use site-relative paths, like /images/foo instead of just foo.
yes, absolute_url() would be nice.
how do i say header.jpg.absolute_url() ?
zope says header does not exist .. yeah, it really doesnt. but i need header.jpg :)
ARGH !!!
<dtml-var "_['header.jpg'].absolute_url()">
Hi, --On Sonntag, 24. November 2002 21:30 +0100 jonatan <jonatanpelikan@freemail.hu> wrote:
On Sun, 2002-11-24 at 21:09, Tino Wildenhain wrote:
Hi Jonatan,
just fix up your DTML :-) Use site-relative paths, like /images/foo instead of just foo.
yes, absolute_url() would be nice.
how do i say header.jpg.absolute_url() ?
here/header.jpg/absolute_url :-) ok, you want DTML, so you have to write _['header.jpg'].absolute_url(), or _['header.jpg'].tag() which is probably nicer.
zope says header does not exist .. yeah, it really doesnt. but i need header.jpg :)
You need .jpg? Why? Zope surely does not. Browsers also not. Regards Tino
ARGH !!!
- jonatan
participants (7)
-
Blurg -
Charlie Reiman -
Dylan Reinhardt -
Janko Hauser -
jonatan -
Paul Winkler -
Tino Wildenhain