On 3 Sep 2013, at 10:36 AM, Jonathan Lundell <jlund...@pobox.com> wrote:
> 
> I have a module in my app's modules/ directory that needs a path to a file in 
> private/ at import time (so I can't pass the path in).
> 
> Using fileutils.abspath, I have to write:
> 
>> abspath('applications', 'watchup', 'private', filename)
> 
> 
> presumably because in abspath:
> 
>>    return os.path.join(global_settings.applications_parent, path)
> 
> 
> ...global_settings is empty at import time? (I haven't looked explicitly.)
> 
> I'd rather not hard-code the application name into the module, of course, 
> though it's not a huge hardship in this case.
> 
> I don't quite understand why this isn't working. I'm calling import in the 
> context of a request, so I'd think that I'd get the whole path without having 
> to pass in the 'applications/appname' portion.
> 
> What am I missing?

Well, this for one thing: that's what application_parent is supposed to be. So 
the code is working as intended; I just need a way of determining the 
application name.

I suppose I could use __file__ ...

-- 

--- 
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.

Reply via email to