On 12/20/12 8:06 AM, Ed Leafe wrote:
> On Dec 20, 2012, at 9:59 AM, Paul McNett <[email protected]> wrote:
> 
>> Alongside my other large commit to limit imports of subpackages when issuing 
>> 'import
>> dabo', I'm also changing our 'from settings import *' call to 'import 
>> settings', and
>> going through all our code and changing code like 'if dabo.eventLogging:' to 
>> 'if
>> dabo.settings.eventLogging:'.
>>
>> The old global import will still happen by default, so this won't break 
>> things for
>> people immediately.
>>
>> However, when I'm done I'm going to need to rebuild the .po files for the
>> localization, since the docstring in dObject had an example which referred to
>> 'dabo.eventLogging' and I changed that to dabo.settings.eventLogging.
> 
>       I don't see the advantage of this change, except for the relation 
> between file structure and code references. The settings.py file was created 
> to put the configuration stuff for the dabo module all in one place. These 
> settings, though, represent attributes of the dabo module, rather than a 
> subpackage with a distinct purpose.
> 
>       If the goal is to eliminate the 'from settings import *', I would 
> prefer moving the code in settings.py into __init__.py. This would not break 
> anything, while at the same time removing the objectionable use of 'import 
> *'. It would also be semantically more accurate than making the settings 
> distinct from the dabo module itself. It would also preserve the behavior of 
> settings_override.py in applications.
> 
>       Thoughts?

It wasn't that 'import *' is too objectionable but rather the sheer number of 
names
that wound up in dabo's namespace. The reason for these changes is to allow a 
web app
to import and use the reportwriter at runtime without spending cycles loading
unneeded things (dabo.db, dabo.biz, dabo.ui, dabo.dApp). During my process of
widdling down the imports I got annoyed by all the names in dir(dabo) and 
thought
that reading our code would be easier with an explicit settings namespace.

Paul



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to