Raj schrieb:
> Hi
> I am developing a data-driven application with TG
> I needed to distribute the SQLObject model classes into multiple
> files.
> I have done it as described below
> *)Created a 'models' directory
> *)Within that created two model files eg: a.py and b.py
> *)Created an __init__.py file within the models directory with
> contents
> from turbogears.database import PackageHub
> __connection__ = hub = PackageHub('projectname')
> from projectname.models.a import *
> from projectname.models.b import *
>
> I could run the application without any problems.
>
> But, when I added values into a SingleSelectField widget, the problems
> began to arise
>
> *)I created a form widget with a SingleSelectField as shown below:
> class FormFields(widgets.WidgetsList):
> txnType=categories =
> widgets.SingleSelectField(options=getValuesFromA())
>
> Here getValuesFromA() is a callable which returns a list of tuples
> required for the SingleSelectField as shown below:
> def getValuesFromA():
> vals = [(A.field1, A.field2)
> for item in A.select()]
>
> return vals
>
> Here 'A' is a model class in a.py
>
> When trying to run the application, the following error occurs.
> KeyError: 'No database configuration found!'
>
> Anyone have any idea to help me?
>
> I really got stuck...
Try passing the callable as such, instead of invoking it.
SingleSelectField(options=getValuesFromA)
Note the missing parentheses.
Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---