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

Pavol Babincak pbabinca at redhat.com
Mon Apr 6 16:38:24 UTC 2015


On 04/06/2015 06:19 PM, Peter Robinson wrote:
> 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?
It won't be local_alias. alias in this context refers to second argument 
of function export_in(). The problem with the previous code is described 
in this FAQ: 
https://docs.python.org/2/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value
-- 
Pavol Babincak
Release Engineering, Red Hat


More information about the buildsys mailing list