On 11/18/06, Jorge Vargas <[EMAIL PROTECTED]> wrote:
>
> I see that you have some model code twice,
>
> for example check lines 154-158 and 812-816
>
> you may want to clean it up a bit, make sure that your tbl array is
> not returnning any obscure data.
>

Yeah, I agree with Jorge here.  You're doing some fairly funky stuff
with SA but your code will need to be neater otherwise it's going to
end up being hell to keep straight.  However, I'm not sure that this
is the problem (although it will definately help you down the line if
you do clean it up).

I think that your for loop that populates the tbl dictionary in your
model is being executed more than once at some point in your code.
You can do either or both of the following:

1) Put that whole section in a function and have it called just once
in your start-<project>.py or maybe in your controllers.py under your
imports.

2) Add a check to see if the table has already been initialised:

for name,schemaname in engine.execute("""SELECT tablename,schemaname
                                         FROM pg_tables
                                         UNION SELECT viewname AS
tablename, schemaname
                                               FROM pg_views""").fetchall():
    if not schemaname in ('information_schema','pg_catalog'):
        print name
        try:
            tbl[name] = database.metadata.tables[name]
        except KeyError:
            tbl[name] = Table(name, database.metadata, autoload=True)

Hope this helps.

-- 
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to