On Thu, Jul 24, 2008 at 11:18 AM, Lukasz Szybalski <[EMAIL PROTECTED]> wrote: > On Thu, Jul 24, 2008 at 9:01 AM, Lukasz Szybalski <[EMAIL PROTECTED]> wrote: >> On Wed, Jul 23, 2008 at 9:13 PM, Patrick Lewis <[EMAIL PROTECTED]> wrote: >>> >>> >>> >>> On Jul 23, 5:03 pm, "Lukasz Szybalski" <[EMAIL PROTECTED]> wrote: >>> >>>> >>>> @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 >>>> >>> >>> how are you importing this? >>> >>> If it's like: >>> from myapp.controllers import is_in_my_group >> >> 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? >> > > 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" >
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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

