[Zope] Modifying a Dictionaries in an Extenal Method

Edward Huixquic huixquic at gmail.com
Mon Jun 6 02:13:11 EDT 2005


Thanks Tino for your comments,   here are some more comments:

On 6/5/05, Tino Wildenhain <tino at wildenhain.de> wrote:
<cut stuff>
> 
> def pyUpdate(self,REQUEST):
>      fields=REQUEST['fields']
>      x=REQUEST['x']=fields[0]
>      y=REQUEST['y']=fields[1]
>      x.balance=5000
>      y.balance=5000
> 
> 
> I dont think the loop above makes any sense :)

Sure it doesn't make any sense. It is just a proof  I wrote trying to
find out why the
object I tought as dictionaries where not working as that, turned out
to be "records" objects.

> The common idiom goes like this:
> 
> results = [{'balance':balanceexpression(item),
>             'lastname':item.lastname,
>             'name':item.name}
>             for item in context.SomeZSQLMethod()]
> 
> for example.
> 
> For more advise I think we need the big picture (in english
> words) what you are doing here.

What I am trying to do is move towards python external methods (and
eventually products) instead of doing logic in dtml or within the ZMI.

Generally speaking there are SQL queries, gotten via a
ZSQLMetod.dictionaries() and the this list of dictionaries is fed into
my python external method, there is where the loop comes into play 
lin something like

     for onerecord in someSQLmethod.dictionaries():
          processing the individual record code....

I just wonder if this is the best approach.... I must add that there
are also web page designers in the mix, they do the HTML/CSS stuff and
I am supposed to do the database and application logic stuff.   I am
just trying to find the best way to organize the sites within Zope ,
separating presentation and logic and making the thing maintanable.
If you have suggestions on some documentation about this subjects in
Zope, it's be well used.

Your comments are welcome.   Thanks again

Edward


More information about the Zope mailing list