durusmail: quixote-users: _q_resolve summary
_q_import summary
2003-01-21
2003-01-21
2003-01-21
_q_resolve summary
2003-01-21
2003-01-21
2003-01-21
2003-01-21
2003-01-21
2003-01-21
2003-01-21
2003-01-21
2003-01-22
2003-01-21
2003-01-23
_q_resolve summary
Andrew Kuchling
2003-01-21
On Tue, Jan 21, 2003 at 11:16:53AM -0500, Greg Ward wrote:
>Either of these is fine by me.  I have nothing against the concept, and
>I *think* _q_import() is an OK name.  I can definitely see Jon's need

I'm now working on this.  Given that it will also be called on class
instances, _q_resolve is a better name than _q_import.

Interface question: _q_resolve is called iff the name is listed in
_q_exports.  What exception should be raised if _q_resolve() returns
None?  This might happen if you add a name to _q_exports and forget to
update _q_resolve. Most people's _q_resolve() will probably look like:

def _q_resolve (component):
    if component == 'thing1':
         from place1 import thing1 ; return thing1
    elif component == 'thing2':
         from ...

Users may not have put an 'else' on that 'if' statement.  Because this
represents an error on the part of the application programmer,
PublishError doesn't apply ("PublishError exceptions are raised due to
some problem with the data provided by the client", quoting from the
docstring), so we need a different exception.  Options:

1) quixote.errors.BozoProgrammerError, or some less rude name; suggestions?
2) Python's RuntimeError
3) NameError
4) Use 'assert object is not None', in which case it'll be AssertionError.

No one will be catching this exception or looking for it (unless
they're awesomely evil).  I vote for 2).

--amk                                                    (www.amk.ca)
After all, we are human beings, and not creatures of infinite possibilities.
      -- Robertson Davies, _Conversations_

reply