As Bruno suggested:
def add():
tablename = request.args[0]
if not tablename in db.tables(): error() # or other set of allowed
tables.
form = SQLFORM(db[tablename])
On Nov 21, 8:49 pm, monotasker <[email protected]> wrote:
> I'm trying to abstract several content creation controllers into one
> controller. I want to use request.args[0] to set the db table in which the
> new row will be created. So far I've got this:
>
> def add():
> the_table = request.args[0]
> tb = "db.%s" % the_table
> form = SQLFORM(tb)
>
> but I'm getting an error that "str object does not have the attribute
> 'writeable'". It seems like SQLFORM is treating 'tb' as a string object
> rather than taking the string's content as an argument. Am I missing
> something? Is there a better way to do this?
>
> Thanks,
>
> Ian