Hi!

I use the DB connection from many application modules. In fact, I test some technic hardly on the local machine. When I get coming result I upload the script to the web server. I have 2 functions: connect_db and loc_connect_db. First contains the remote server login data, second - local server. Before I upload the script to the server I just switch loc_connect_db to connect_db. That's it :)

John Salerno wrote:
Nicolay A. Vasiliev wrote:

  
def loc_connect_db():
   """
   The DB connection subroutine
   """
   db = MySQLdb.connect(host = "localhost",
                       user = "root",
                       passwd="mysql",
                       db="some_db")
   return db
    

Hi. Sorry I can't help, but I'm interested in learning about mysqldb and 
I was wondering why you chose to wrap the 'connect' function inside your 
own function. Does this accomplish something that I'm not seeing? 
Couldn't you just use the body of the loc_connect_db() function as your 
actual code in order to get 'db'?

Thanks.
  

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to