Yeah, I introduced that bug last night when I fixed my broken singleton imp, moving the
initialization into the constructor. Thanks for the catch, Mark.
-steve
On May 27, 2011, at 8:06 AM, Chris Lalancette wrote:
On 05/27/11 - 10:06:44AM, Mark McLoughlin wrote:
> Introduced by commit 0e931dd3
> ---
> imgfac.py | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/imgfac.py b/imgfac.py
> index 2854fc7..64fa701 100755
> --- a/imgfac.py
> +++ b/imgfac.py
> @@ -44,7 +44,7 @@ class Application(object):
>
> def __new__(cls, *p, **k):
> if cls.instance is None:
> - i = super(Application, self).__new__(cls, *p, **k)
> + i = super(Application, cls).__new__(cls, *p, **k)
> # initialize here, not in __init__()
> i.log = logging.getLogger('%s.%s' % (__name__,
i.__class__.__name__))
> i.daemon = False
> @@ -55,7 +55,7 @@ class Application(object):
> # by setting TMPDIR here we make sure that libguestfs
> # (imagefactory -> oz -> libguestfs) uses the temporary directory
of
> # the user's choosing
> - os.putenv('TMPDIR', self.app_config['tmpdir'])
> + os.putenv('TMPDIR', i.app_config['tmpdir'])
>
> cls.instance = i
> elif(len(p) | len(k) > 0):
Took me a second, but I think I understand. __new__ is called during object
creation, which means there is not yet any "self" (which is reflected in the
arguments to the method). So we create the object ourselves calling the super
method, at which point we only have i. Therefore, when doing the rest of
initialization, we need to use i, not self. Makes sense to me.
ACK
--
Chris Lalancette
_______________________________________________
aeolus-devel mailing list
aeolus-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/aeolus-devel