[Tutor] Get variable values

Mário Gamito gamito at gmail.com
Thu Feb 1 19:55:31 CET 2007


Danny Yoo wrote:
> Ok, good.  Next time, make it more clear to the group that things worked 
> out fine, to close the thread.  Remember, we can't read your mind: make 
> it explicit.
> Otherwise, people will continue to try to help you with something that 
> you don't have problems with anymore.  *grin*

>    1.  "Autocommit" mode is off.  That is, by default, your database 
> access is transactioned.  That means that if you don't commit, the 
> database rolls any changes right back out as soon as the connection 
> closes.  See:
>     http://www.amk.ca/python/writing/DB-API.html
>    2.  String literals are really string literals.  That is, the code as 
> written above will insert the literal string "entry[key].url" as a title.
Yes, i know, i'm a long time PHP programmer.
I was just testing.

> Use prepared statements.  See:
>     http://mail.python.org/pipermail/tutor/2003-April/022010.html
> for an example.
Yes, i know too.

> There's also a third thing I'd suggest: abstract our the 
> database-creation into a separate function.  You're probably going to be 
> opening connections in several places in your code: keep the 
> connection-open logic in a single place so you can more easily change 
> configurations.
> If it's possible, pull out the code that touches the database into a 
> separate module layer.  People on the list can talk about this more if 
> you'd like.
Yes, that will be for later.

For now, i'd just like to pull out the variables values, and i don't 
know how.
For those who may be interested it's about file __init.py__ from 
planetplanet code.

Warm Regards,
Mário Gamito

More information about the Tutor mailing list