On Wed, Dec 04, 2002 at 04:49:20PM -0500, Greg Ward wrote:
> _q_getname() does one thing fairly well. _q_import() does seem a bit
> arcane, but if it's really needed, IMHO it should be a separate bit of
> _q magic.
Alright. However, if we introduce _q_import we should make it easier to
use. How about this:
if hasattr(container, '_q_import'):
importer = getattr(container, '_q_import')
object = importer(component)
# next line is new
setattr(container, component, object)
else:
...
That way the attribute gets set automatically. I'm still not sure I
like _q_import as a name. I can imagine code like this:
_q_exports = ['mypage']
class MyPage:
...
def __call__(request):
...
def _q_import(component):
return MyPage()
Maybe is should be something like _q_create_export.
Neil