If your contrib needs to have its own models and controllers, then you should create it as a plugin. Or you can create a module and define an API for it, take a dummy example.
/modules/myawesomemodule.py class MyAwesomeClass(object): """ it creates the Awesome object which is a login_method to use include in your models db = DAL(........) from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something """ def __init__(db, *args, **kwargs): self.db = db def define_tables(self, migrate=True): self.table1 = self.db.define_table("table1", Field("a_field"), migrate=migrate ) self.table2 = self.db.define_table("table2", Field("a_field"), migrate=migrate ) def do_something(self): self.data = self.db(.....).select() # do domething return data Then in following your documentation developers should use you module api as: models/db.py db = DAL(.....) from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something On Sat, Feb 9, 2013 at 5:34 AM, Alec Taylor <alec.tayl...@gmail.com> wrote: > But I am creating a contrib for: > https://github.com/web2py/web2py/tree/master/gluon/contrib/login_methods > > (OAuth2; my work-in-progress is on Github) > > But because of the design of the standard I require 3 additional > tables + a user table. > > So how do you propose I manage this scenario? > > On Sat, Feb 9, 2013 at 6:26 PM, Bruno Rocha <rochacbr...@gmail.com> wrote: > > Usually you create a "script" file in /models/db.py then you define your > > tables there, so when starting in shell mode you pass -M > > > > python web2py.py -S yourapp -M > > > > -M run the models/* files and defines your table as "object" for you to > > access. > > > > Every framework works in this way. > > > > Optionally, you can use db.executesql("PUT YOUR SQL HERE") and do it by > your > > own... > > > > > > On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor <alec.tayl...@gmail.com> > wrote: > >> > >> Hold up; you mean to tell me I need to redefine the schema each time a > new > >> db (DAL object) needs to access it? > >> > >> That sounds silly. > >> > >> Isn't there a way around this? > >> > >> > >> On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote: > >>> > >>> let say you have table1 and table2 in database, > >>> > >>> you shoud define your tables > >>> > >>> db.define_table('table1', > >>> ..) > >>> > >>> and only after that you will have access to db.table1 > >>> > >>> you can;t access db.table2 if it is not defined even if it exists in > the > >>> database > >> > >> -- > >> > >> --- > >> You received this message because you are subscribed to the Google > Groups > >> "web2py-users" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to web2py+unsubscr...@googlegroups.com. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > > > -- > > > > --- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to web2py+unsubscr...@googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.