Modify ↓
Opened 19 years ago
Closed 19 years ago
#3063 closed defect (fixed)
Invalid environment verifier code when wrong environment path is used
Reported by: | Emmanuel Blot | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | general | Version: | devel |
Severity: | trivial | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The following piece of code env.py is in trouble
def verify(self): try: fd = open(os.path.join(self.path, 'VERSION'), 'r') assert fd.read(26) == 'Trac Environment Version 1' finally: fd.close()
if the path (environment path set by the user) is incorrect, open
method fail, fd
never gets initialized, and fd.close()
fails with the following exception:
Failed to open environment. local variable 'fd' referenced before assignment Traceback (most recent call last): File "/Users/eblot/Sources/Svn/edgewall.com/trunk/trac/scripts/admin.py", line 132, in env_open self.__env = Environment(self.envname) File "/Users/eblot/Sources/Svn/edgewall.com/trunk/trac/env.py", line 121, in __init__ self.verify() File "/Users/eblot/Sources/Svn/edgewall.com/trunk/trac/env.py", line 173, in verify fd.close() UnboundLocalError: local variable 'fd' referenced before assignment
Attachments (0)
Change History (2)
comment:1 by , 19 years ago
Milestone: | → 0.10 |
---|---|
Owner: | changed from | to
Priority: | lowest → normal |
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
oops, yes.