localhost/mysubapp/index
The file structure is similar to tg registration:
/myapp/
-controller.py
-model.py
--\mysubapp
----controller.py
----model.py
I initiate my mysubapp controller in main controller.py like this:
class Root(controllers.RootController):
registration = reg_controllers.UserRegistration()
mysubapp = mysubapp_controllers.mysubappRoot()
I have a custom predicate in my first controller.py, how can I
reference it from the subapp controller.py?
@identity.require(is_in_my_group())
gives me:
File "/home/xxx/xturbogears/myapp/myapp/mysubapp/controllers.py",
line 69, in mysubappRoot
@expose(template="myapp.templates.mysubapp.view")
NameError: name 'is_in_my_group' is not defined
Do I use Super() to reference files from main controller.py?? or??
Thanks,
Lucas
I don't know why but this is not working.
Traceback (most recent call last):
File "start-myapp.py", line 15, in ?
start()
File "/home/lucas/turbogears/myapp/myapp/commands.py", line 52, in start
from myapp.controllers import Root
File "/home/lucas/turbogears/myapp/myapp/controllers.py", line 16, in ?
from myapp.mysubapp import controllers as mysubapp_controllers
File "/home/lucas/turbogears/myapp/myapp/mysubapp/controllers.py",
line 19, in ?
from myapp.controllers import is_in_my_group
ImportError: cannot import name is_in_my_group
The is_in_my_group is defined above the main root class in main
controller. What else am I missing here?
Lucas
It works if I take out the code and put it in separate file, and then
I add this line to main controller and the plugin controller.
from myapp.somefile import is_in_my_group
Then it works, but it doesn't work if I import it the "from
myapp.controllers import is_in_my_group" .
I guess somehow the from myapp.controllers gets confused with "from
myapp.mysubapp.controllers"
Lucas
I have to say that the tg-registration plugin style, of where you keep
files works pretty nice. I got my localhost/subpage/index working,
and it is so much easier to maintain.
Now If I could find an easy way to go from sqlalchemy records (updated
daily) to rss feed, with usernam/password for outsiders and no
authentication for inside people.
Lucas