I have a block of code that several functions share (with slight
modifications) and I want to put it into an external function.  The
problem is that the other functions point to their own respective
tables.  So in the end, I have something like this:

---------------
in class Item:
def index():
...
result = MyTableItem(item=item, ...)    #item is foreign key pointing
to a table called Item
...

in class Place:
def index():
...
result = MyTablePlace(place=place, ...)  #place is FK pointing to a
table called Place
...

...etc...
---------------

I want to put it into a common function but I don't know how to replace
the item=item part (or place=place) with a variable.  This is what I
had in mind:

---------------
def commonFunction(myDBTable, type):
...
result = myDBTable(type=type, ...)
...
---------------

But obviously, the type=type part is wrong. Does anyone know how to fix
this?


Thanks so much,

Frank


--~--~---------~--~----~------------~-------~--~----~
 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