[Zope] sha and newbie db question.

Alejandro Fernandez shomon@softhome.net
Wed, 19 Jun 2002 10:58:44 +0200


Hi,

I have 2 questions:

I'm trying to replicate the following php code in zope: 

$code = $HTTP_POST_VARS["CODE"];
$codemd5  = md5($code);

I believe that in straight python, this would be:

hcode = sha.new(code).hexdigest()

(because as far as I know, there's no md5 equivalent of "hexdigest").

But when I run this in a python script, which recieves such a value from a
dtml method with a form in it, it complains that it's not allowed to run
"new". I'm sorry if this is a well known security restriction, and the
page of the zope book or of some manual to get around it would be enough
for me thanks!

Second problem is a lot easier: I've looked at the relational database
chapter of the zope book, but have not found exactly how to do a call to a
zsql method from within a python script. Is there somewhere where I can
get examples of the dtml/python script code behind a database backed
website? The code in particular wouldn't be to display something, but for
operations such as inserting, deleting, cacheing queries, storing
variables, etc.

Thanks so much!

Ale

-- 
Alejandro Fernandez
Electronic Group Interactive
--+34-65-232-8086--