#751: UnboundLocalError: local variable 'rsys' referenced before assignment
------------------------+-----------------------
Reporter: olemis | Owner: nobody
Type: defect | Status: new
Priority: critical | Milestone:
Component: trac core | Version: 0.8.0dev
Resolution: | Keywords: resources
------------------------+-----------------------
Changes (by olemis):
* keywords: => resources
* owner: => nobody
* component: => trac core
* priority: major => critical
Old description:
> Steps to reproduce the issue :
>
> {{{#!sh
>
> $ /srv/venv/bh/trunk/bin/python
> Python 2.7.4 (default, Sep 26 2013, 03:20:26)
> [GCC 4.7.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from trac.env import open_environment as oe
> >>> env = oe('/path/to/env')
> >>> from trac.resource import Neighborhood as N, Resource as R,
> get_resource_name, get_resource_description, get_resource_shortname
> >>> r = N('product', 'asdf')('ticket', 1)
> >>> r
> <Resource u'ticket:1' in Neighborhood product:asdf>
> >>> get_resource_name(env, r)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/path/to/bh/trac/trac/resource.py", line 682, in
> get_resource_name
> return get_resource_description(env, resource)
> File "/path/to/bh/trac/trac/resource.py", line 673, in
> get_resource_description
> nbhprefix = rsys.neighborhood_prefix(resource.neighborhood)
> UnboundLocalError: local variable 'rsys' referenced before assignment
> >>> get_resource_description(env, r)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/path/to/bh/trac/trac/resource.py", line 673, in
> get_resource_description
> nbhprefix = rsys.neighborhood_prefix(resource.neighborhood)
> UnboundLocalError: local variable 'rsys' referenced before assignment
> >>> get_resource_shortname(env, r)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/path/to/bh/trac/trac/resource.py", line 685, in
> get_resource_shortname
> return get_resource_description(env, resource, 'compact')
> File "/path/to/bh/trac/trac/resource.py", line 673, in
> get_resource_description
> nbhprefix = rsys.neighborhood_prefix(resource.neighborhood)
> UnboundLocalError: local variable 'rsys' referenced before assignment
> }}}
New description:
Steps to reproduce the issue :
{{{#!sh
$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from trac.env import open_environment as oe
>>> env = oe('/path/to/env')
>>> from trac.resource import Neighborhood as N, Resource as R,
get_resource_name, get_resource_description, get_resource_shortname
>>> r = N('product', 'asdf')('ticket', 1)
>>> r
<Resource u'ticket:1' in Neighborhood product:asdf>
>>> get_resource_name(env, r)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/bh/trac/trac/resource.py", line 682, in get_resource_name
return get_resource_description(env, resource)
File "/path/to/bh/trac/trac/resource.py", line 673, in
get_resource_description
nbhprefix = rsys.neighborhood_prefix(resource.neighborhood)
UnboundLocalError: local variable 'rsys' referenced before assignment
>>> get_resource_description(env, r)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/bh/trac/trac/resource.py", line 673, in
get_resource_description
nbhprefix = rsys.neighborhood_prefix(resource.neighborhood)
UnboundLocalError: local variable 'rsys' referenced before assignment
>>> get_resource_shortname(env, r)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/bh/trac/trac/resource.py", line 685, in
get_resource_shortname
return get_resource_description(env, resource, 'compact')
File "/path/to/bh/trac/trac/resource.py", line 673, in
get_resource_description
nbhprefix = rsys.neighborhood_prefix(resource.neighborhood)
UnboundLocalError: local variable 'rsys' referenced before assignment
}}}
--
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/751#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker