← Back to team overview

openerp-india team mailing list archive

[Bug 1099352] Re: [trunk/7.0]Unable to upload PDF attachment to project

 

When trying to attach an PDF file to a project on
openerp7-nightly(2013-01-15) it failed.

But I could not see that it failed in the webinterface. The overlay and
spinner was showing along with a text claiming that it was still
loading. This text changed on occasions ensuring me that it was still
loading.

However after a couple of minutes I got bored and open up Firebug.

Reloading the page at this point resulted in a fairly large Python
traceback - one which I did not keep.

With Firebug open I tried to attach the same file again resulting in the
same behaviour.

When looking at the reply from the POST I saw that the resulting JSON
object contained an error line. Claiming that it was unable to
"TypeError: 'NoneType' object is not iterable".

I went into the code and traced the issue to the method
"upload_attachment".

By hacking "upload_attachment" at line 1293 in
openerp/addons/web/controllers/main.py and returning a proper python
traceback I was able to figure out where to look for the underlying
issue.

args = {'error':[e.faultCode, traceback.format_exc()] } # <-- major hack

The problem occurred from within _index in
openerp/addons/document/document.py around line 130. The culprit was:

mime, icont = cntIndex.doIndex(data, datas_fname,  file_type or None,
None)

It returns None when something goes wrong internaly. Going into
content_index.py (which is the method cntIndex.doIndex). I found that it
sets res = None when it catches any exception while trying to perform
indexing.

It all boils down to line 188 in content_index.py which sets res = None
when indexing fails. It should set it to (mime, None) or (None, None)
since everywhere this method is invoked it expects the output to be a
2-tuple.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1099352

Title:
  [trunk/7.0]Unable to upload PDF attachment to project

Status in OpenERP Server:
  Incomplete

Bug description:
  When uploading an attachment the webui keeps on loading and loading.
  This is due to an error when executing upload_attachment in
  'web/controllers/main.py'. This in turn is due to an uncaught
  exception in the method 'document_file._index' in
  'addons/document/document.py'.

  When 'cntIndex.doIndex' is executed it will return None when it fails
  to create an index. However the line reads: "mime, icont =
  cntIndex.doIndex(data, datas_fname,  file_type or None, None)". mine,
  icont = None will result in the uncaught exception.

  This issue exists in two places in document.py.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1099352/+subscriptions


References