durusmail: qp: problem in publisher init
problem in publisher init
2005-11-26
2005-11-28
2005-11-28
2005-11-28
problem in publisher init
David Binger
2005-11-28
On Nov 28, 2005, at 10:01 AM, mario ruggier wrote:

> On Nov 28, 2005, at 2:52 PM, David Binger wrote:
>
>> I think you probably should, instead, override the __init__() if your
>> initialization code requires the site (or the root_directory) to be
>> present.  This is better because your code will not then depend on
>> the
>> ordering of these statements in the Publisher.__init__().
>
> Is there a reason that I am not aware of for the current ordering?

No.

> It is not a problem to override the __init__(), but it seems a pity
> to duplicate this code just for this, unless there are other
> reasons for it to be as it is...

I wasn't suggesting code duplication.
You could call Publisher.__init__() in MyPublisher.__init__() and
then add the additional initialization statements that you want.

>
>> The ensure_initialized() method is really intended to make
>> sure that future calls to get_users() and get_sessions() can work
>> the first time a site starts.  It is probably best to avoid
>> mixing this purpose with some other, since commit() calls are
>> involved.
>
> Yes, I realize this, although I initially also had the reaction
> that the name might be better as ensure_db_is_initialized(). Anyhow
> this is precisely what I am trying to do... I am creating a first
> non-null user, that can log in... and calling set_password() on it,
> which is where it fails (as it needs the site's name for the realm).

Now I understand.  I'll make the change you suggested.



reply