[Zope] Zope Questions
dman
dman@dman.ddts.net
Mon, 6 May 2002 22:31:19 -0500
--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mon, May 06, 2002 at 09:46:52PM -0400, George M. Ellenburg wrote:
| Here's what I'm trying to do:
|
| I'm trying to create a "tool-tip" (which is actually contained in a
| frame) and would like to pass a parameter to the DTML document which
| contains the HTML, etc. for the tool-tip. Something like:
| <a href=3D"show_tip?a=3Db&c=3Dd">
| Q: Is there a magical Zope variable that contains the arguments
| passed on a GET URI (as in PHP?)
Take a look at the REQUEST object. It will contain all the form
parameters and other information. It is always (and only) available
when an object is "called from the web".
| Q: Must any variable be declared first?
Variables are not declared[1] in python; but accessing a non-existant
variable is an error. I'm not sure with dtml, but is probably the
same way.
[1] : C, C++ and Java require variable declarations. They are
separate statements from assignment.
| - "case" statement
| Q: Does there exist the equivalent of a shell "case" statement in Z=
ope?
| (This is in line with my previous questions).
Python does not have a case statement. You can use an if-else ladder
instead, or use a dictionary with function objects as the values.
The dictionary technique is often done like this :
def handler1() :
print "block 1"
def handler2() :
print "block 2"
def handler3() :
print "block 3"
switch =3D { 'a' : handler1 , 'b' : handler2 , 'c' : handler3 }
choice =3D raw_input( "Choose a, b, or c " )
if not switch.has_key( choice ) :
print "invalid choice"
else :
# this is the switch/case statement here
switch[choice]()
I don't know if that fits in to your framework at all or not. I'm
still quite inexperienced at web app design and development, though
I've done a fair amount of python and java programming.
HTH,
-D
--=20
I tell you the truth, everyone who sins is a slave to sin. Now a slave
has no permanent place in the family, but a son belongs to it forever.
So if the Son sets you free, you will be free indeed.
John 8:34-36
=20
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg
--6TrnltStXW4iwmi0
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjzXSocACgkQO8l8XBKTpRRr4QCdH+LtOaoZ3W+vLBlvgNkRZHJq
EJEAn2o+OAlORVxs8LlxMUWPS3wNIcWP
=UGO4
-----END PGP SIGNATURE-----
--6TrnltStXW4iwmi0--