[Zope] sha and newbie db question.
Alejandro Fernandez
shomon@softhome.net
Wed, 19 Jun 2002 19:32:55 +0200
Ok, thanks!
There were a lot of comments under the example with a "self" parameter, if
I remember correctly - maybe others found that to be a hurdle too! All
working now... :)
Ale
On Wed, 19 Jun 2002 13:17:14 -0400
Jens Vagelpohl <jens@zope.com> wrote:
> please keep this on the list so everyone can see it...
>
> you can pass context by making "self" the first argument in the method
> defined in the module you put in the Extensions folder. then use self
> like you use context. it will be passed in automatically when you call
> the external method.
>
> jens
>
>
>
> On Wednesday, June 19, 2002, at 01:12 , Alejandro Fernandez wrote:
>
> > Hi,
> >
> > Thanks for your answer. Just gone through the entire zope book
> > "advanced scripting" chapter, but I couldn't find an example of how to
> > pass context to an external method... Could you give me an example
> > please?
> >
> > Thanks!
> >
> > Ale
> >
> > On Wed, 19 Jun 2002 12:39:40 -0400
> > Jens Vagelpohl <jens@zope.com> wrote:
> >
> >> external methods don't know "context" unless you pass it in via your
> >> call to the method.
> >>
> >> jens
> >>
> >>
> >> On Wednesday, June 19, 2002, at 12:03 , Alejandro Fernandez wrote:
> >>
> >>> Hi,
> >>>
> >>> I just tried it in an external method, and it said "global name
> >>> context not defined" - is this because it's in an external method?
> >>> Maybe I should be importing something, or accepting some kind of
> >>> parameter so it recognizes what the context is...
> >>>
> >>> Thanks again!
> >>>
> >>> Ale
> >>>
> >>> On Wed, 19 Jun 2002 14:51:41 +0200
> >>> H.de.Wit@SFK.NL wrote:
> >>>
> >>>>
> >>>> I don't know anything about sha, but you can call a zsql methode
> >>>> sql_abcdefg from a python script this way:
> >>>> RS=context.sql_abcdefg(var1=v1,var2=v2)
> >>>> for row in RS:
> >>>> for column in row:
> >>>> print column
> >>>>
> >>>>
> >>>> Met vriendelijke groeten,
> >>>>
> >>>> Hans de Wit
> >>>> Stichting Farmaceutische Kengetallen
> >>>> Postbus 30460
> >>>> 2500 GL DEN HAAG
> >>>> Tel. 070-3737448
> >>>> Fax 070-3737445
> >>>>
> >>>>
> >>>>
> >>>
> >>>> Alejandro
> >>>>
> >>>
> >>>> Fernandez To:
> >zope@zope.org>>>
> >>>
> >>>> <shomon@softhome cc:
> >>>>
> >>>
> >>>> .net> Subject: [Zope] sha
> >>> and> newbie db question.
> >>>>
> >>>> Sent by:
> >>>>
> >>>
> >>>> zope-admin@zope.
> >>>>
> >>>
> >>>> org
> >>>>
> >>>
> >>>>
> >>>
> >>>>
> >>>
> >>>> 19-06-02 10:58
> >>>>
> >>>
> >>>>
> >>>
> >>>>
> >>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> 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
> >>
>