me
mlists at e-beyond.de
Wed Mar 14 04:55:25 EST 2007
Hello Graham, Am Mittwoch 14 März 2007 10:37:00 schrieb Graham Dumpleton: > > Correct on the underscore, although a .htaccess file is still a good > idea because if someone stuffs up the main Apache configuration they > could inadvertently expose your source code still since the only thing > stopping it from being visible is mod_python.publisher at the moment. That with .htaccess might not be needed. mod_security is filtering every request to *.py and other extensions. But you're right it's a "plus" on security to disallow access using .htaccess. > As far as import_module(), that also should work with that importer > path, although using a non obvious aspect of import_module() which I > am not sure is actually documented as a feature and you probably > should not rely upon. That is that using relative path of './' will > resolve relative to directory the call is done from, but in your case > you have stumbled upon fact that implementation actually also tries to > find a module by appending a './' prefixed path to any of the > directories in the importer path. Thus why it finds './Contents' even > though it isn't in the directory the call is being made from but > elsewhere. You would be better off reserving './' for when you really > mean relative to the same directory. Instead use just: > > module = apache.import_module('Contents/' + className) > > This will have the same affect and that it isn't a relative path > implies better that a search is being done. > > Other options is to be explicit: > > module = apache.import _module('~/_modules/Contents/' + className + > '.py') Okay, it looks also good with the ./ but I follow your hints and change that to the 'Contents/' + className version. I think that might be the best way because I've declaratively configured the path in the apache configuration, when changing that I don't have to change the sources. > Also, please keep followups on the mailing list. Sorry I haven't seen that I'm only replying to you (and not to the list)... Marc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070314/450340e5/attachment.bin
|