[Zope] A corker

Bruce Eckel Bruce@EckelObjects.com
Thu, 17 May 2001 07:57:26 -0700


OK, I've figured this much out so far. I've created one
DTML document for each registration. I'm using acquisition
to pass that document to a DTML method that displays the
document. The URL looks like:
".../Yourfullname3b01efcd/DisplayFullRegInfo" where
Yourfullname3b01efcd is the document name, and
DisplayFullRegInfo is the DTML method.

Now I want to get the information in the document (which is
a python dictionary in text form) and use eval() (which
I've put in an external method) to parse it back into a
python dictionary. To get the data in the document, it
turns out all I have to do is say "PARENTS[0]". Now the fun
starts. This is in DisplayFullRegInfo:

<dtml-let data="PARENTS[0]">
<dtml-var data><hr>
<dtml-var expr="parseSeminarRegistration(data)">
</dtml-let>

I keep getting weird error messages for
parseSeminarRegistration(), which worked in a different
DTML method just fine. The messages complain about the
argument, so I decide to examine the argument type. Here's
the external method, parseSeminarRegistration():

import types
def parseSeminarRegistration(code):
  return 'your type is: ' + str(type(code))
  #return eval(code)

Normally I just use eval(), but this should indicate the
type. Here's the output:

------------------------------------------------------------
--------------------
{'homephone': 'Your home phone (for emergencies)', 'email':
'Your email address', 'admin_email': 'Their email address',
'price_dates': '(("2001-5-15", 1700), ("2001-7-4", 1800))',
'semnumber': '1', 'busphone': 'Your business phone number',
'admin_contact': "Person we should contact about payment,
if it's not you", 'admin_phone': 'Their phone number',
'bill_to': 'Person or company paying for the seminar',
'payment_date': '', 'admin_fax': 'Their fax number',
'country': 'USA or your country', 'state': 'State or
province', 'required_forms': '(("Limited Liability Form",
"N",
"http://www.mindview.net/Seminars/regFormParts/LimitedLiabil
ity"), ("Activity Release Form", "N",
"http://www.mindview.net/Seminars/regFormParts/ActivityRelea
seForm.html"))', 'name': 'Your full name', 'zip': 'Zip or
postal code', 'city': 'City', 'invoice_number': '',
'current_price': '', 'seminar_id': 'Design-A-Day Patterns
Practicum July 30-August 3 ', 'paid': 'N',
'purchase_order_id': '', 'registration_date': '2001/05/15
20:11:07.26156 GMT-7', 'completed': 'N', 'address1':
'Street address', 'address2': 'Second address line, if
needed', 'fax': 'Your fax number, if you have one'}
------------------------------------------------------------
--------------------
 your type is: 


The external method is clearly called, but it simply gives
a blank. No 'None', even, as if *no* argument is being
passed (which I didn't think was possible).

I'm clearly missing something here. (If there's a more
appropriate way to get the data file then tell me to do
that).

Most current information can be found at:
http://www.mindview.net/Etc/notes.html
===================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java 2e" &
"Thinking in C++ 2e"
Please subscribe to my free newsletter -- just send any
email to:
join-eckel-oo-programming@earth.lyris.net
My schedule can be found at:
http://www.mindview.net/Calendar
===================