[PATCH] Make koji.plugin.export_in() decorator working

Peter Robinson pbrobinson at gmail.com
Mon Apr 6 16:19:25 UTC 2015


On Thu, Apr 2, 2015 at 4:31 PM, Pavol Babincak <pbabinca at redhat.com> wrote:
> Python raised problem with local variable before:
>
>     UnboundLocalError: local variable 'alias' referenced before
>     assignment
> ---
>  koji/plugin.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/koji/plugin.py b/koji/plugin.py
> index 1b83365..e189d1f 100644
> --- a/koji/plugin.py
> +++ b/koji/plugin.py
> @@ -118,12 +118,12 @@ def export_in(module, alias=None):
>      """
>      def dec(f):
>          if alias is None:

Shouldn't the above alias now be local_alias too if the rest are being renamed?

> -            alias = "%s.%s" % (module, f.__name__)
> +            local_alias = "%s.%s" % (module, f.__name__)
>          else:
> -            alias = "%s.%s" % (module, alias)
> +            local_alias = "%s.%s" % (module, alias)
>          setattr(f, 'exported', True)
>          setattr(f, 'export_module', module)
> -        setattr(f, 'export_alias', alias)
> +        setattr(f, 'export_alias', local_alias)
>          return f
>      return dec
>
> --
> 1.9.3
>
> --
> buildsys mailing list
> buildsys at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/buildsys


More information about the buildsys mailing list