> Adding log support for the SQL queries seems to be the topic of the
> month... Why are my print statements not enough for debugging? ;-)
> So if someone wants to add log support, I'd suggest trying to have a
> look at trac.env.Environment.get_db_cnx(), which is the usual entry
> point to the DB manipulations. At that time, it should be possible to
> attach a logger (the env.log should do) to the db connection object.
> That logger could be in turn attached to the wrapped cursors created by
> the connection and finally used in execute().
>
> -- Christian

That's insightful for me thank you.  Actually I've been staring at
env.py/Environment/get_db_cnx for the past 30 minutes, because the one
statement that is in it in it is confusing to this python n00b

class Environment
  def get_db_cnx(self):
    return DatabaseManager(self).get_connection()

How does that reference to DatabaseManager(self) work?

When I look at trac/db/api.py, I see:
class DatabaseManager
  def __init__(self):
    ...

Why does Environment/get_db_cnx need to send a reference to itself to
DatabaseManager, and what method in DatabaseManager is answering that
reference?  If it is __init__ how come it's __init__ doesn't look
like:
  def __init__(self, env)
    ...

Can you help me understand this?

Thanks,

Jerry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to