hevel / goflow

Automatically exported from code.google.com/p/goflow
Other
0 stars 0 forks source link

UnboundLocalError in workflow.models #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to add a workitem to a process in leavedemo (programatically, 
not via the web interface).

I found this error on line 315 of goflow.workflow.models:

appname = '%s.%s' % (prefix, appname)

Python throws an UnboundLocalError exception.

This is caught by a generic 'except' which ends up returning None.

Then execute() (line 325) tries to call None, which generates 
a 'NoneType' is not callable error.

This exception then is caught in runtime.models at line 507, sets 
result=None, and calls self.fall_out().

In the end. target_user (line 77 in goflow.runtime.models) gets the value 
of None, and when the log message tries to print 'applicaiton pushed to 
user', it throws an exception because NoneType has no 
attribute 'username.'

So, I believe the error that needs to be fixed in is 
goflow.workflow.models (line 315) so the proper appname is set.

Original issue reported on code.google.com by pedah...@gmail.com on 8 Sep 2008 at 8:01

GoogleCodeExporter commented 9 years ago
Here are the scripts I use to reproduce the bug.

Place both of these in the goflow/leavedemo directory, and run go.sh

Original comment by pedah...@gmail.com on 10 Sep 2008 at 12:54

Attachments:

GoogleCodeExporter commented 9 years ago
What the version or revision do you use ?

FYI your script works on the last truc rev.

Original comment by esimo...@gmail.com on 11 Sep 2008 at 2:25

GoogleCodeExporter commented 9 years ago
This was with 153.  I didn't up before I filed the bug report. I didn't realize 
so
much was still changing.

These two scripts, placed in goflow/leavedemo, and then invoked by ./go.sh, 
produce
for me:

Traceback (most recent call last):
  File "./test_flow.py", line 19, in <module>
    wf = ProcessInstance.objects.start('leave', user, lr)
  File "/usr/lib/python2.5/site-packages/goflow/runtime/models.py", line 77, in start
    log('application pushed to user', target_user.username)
AttributeError: 'NoneType' object has no attribute 'username'

$ svn up
At revision 165.

I also corrected go.sh to call 'python manage.py' instead of running manage.py
directly since it's not executable by default.

Original comment by pedah...@gmail.com on 11 Sep 2008 at 10:37

Attachments:

GoogleCodeExporter commented 9 years ago
This bug was fixed on rev 154.
You should use v 0.62 (rev 157)

Original comment by esimo...@gmail.com on 12 Sep 2008 at 9:18

GoogleCodeExporter commented 9 years ago
Sorry for the trouble.  I realized today there were multiple version floating 
around,
so was probably importing an old version. Sorry about that.

Original comment by pedah...@gmail.com on 17 Sep 2008 at 12:07