[trunk] base_import 500 error on set_file

Bug #1302815 reported by Grover Menacho
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

I've tried loads of times with openerp 8.0dev-20140326-000101 to import a csv file, but javascript console displays this error:

POST http://192.168.2.103:8069/base_import/set_file 500 (INTERNAL SERVER ERROR)

On python debug console: set_file() takes at least 4 arguments (4 given)

I m not sure what's happening right here.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Could you post the logs that were output by the OpenERP server when the import was attempted?

Revision history for this message
Christian Parent (mobidoy) wrote :

I am facing the same issue. See bug report here

https://bugs.launchpad.net/openobject-addons/+bug/1303197

Revision history for this message
Grover Menacho (hmen) wrote :

I'm posting the same code than Christian Parent, because the error was the same:

 2014-04-06 01:11:44,818 1573 ERROR TESTDB werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/share/pyshared/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/share/pyshared/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/usr/share/pyshared/openerp/service/server.py", line 261, in app
    return self.app(e, s)
  File "/usr/share/pyshared/openerp/service/wsgi_server.py", line 215, in application
    return application_unproxied(environ, start_response)
  File "/usr/share/pyshared/openerp/service/wsgi_server.py", line 201, in application_unproxied
    result = handler(environ, start_response)
  File "/usr/share/pyshared/openerp/http.py", line 1094, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/share/pyshared/openerp/http.py", line 1071, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/share/pyshared/werkzeug/wsgi.py", line 579, in __call__
    return self.app(environ, start_response)
  File "/usr/share/pyshared/openerp/http.py", line 1231, in dispatch
    result = ir_http._dispatch()
  File "/usr/share/pyshared/openerp/addons/base/ir/ir_http.py", line 120, in _dispatch
    return self._handle_exception(e)
  File "/usr/share/pyshared/openerp/addons/base/ir/ir_http.py", line 116, in _dispatch
    result = request.dispatch()
  File "/usr/share/pyshared/openerp/http.py", line 534, in dispatch
    r = self._call_function(**self.params)
  File "/usr/share/pyshared/openerp/http.py", line 295, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/share/pyshared/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/share/pyshared/openerp/http.py", line 292, in checked_call
    return self.endpoint(*a, **kw)
  File "/usr/share/pyshared/openerp/http.py", line 635, in __call__
    return self.method(*args, **kw)
  File "/usr/share/pyshared/openerp/http.py", line 338, in response_wrap
    response = f(*args, **kw)
TypeError: set_file() takes at least 4 arguments (4 given)

But I've seen that someone already solved it. I don't know who. Here is the patch for the file

Revision history for this message
Christian Parent (mobidoy) wrote :

I did edit the /openerp/addons/base_import/controllers.py file to make the mods, updated the module and it does work as supposed to.

Revision history for this message
Parag Kumar (parag-s) wrote :

This issue can be resolved by making changes in addons/base_import/controller.py file and upgrading base_import module.

import simplejson
from openerp.http import Controller, route, request

class ImportController(Controller):
     @route('/base_import/set_file')
     def set_file(self, file, import_id, jsonp='callback'):
         import_id = int(import_id)

         written = request.session.model('base_import.import').write(import_id, {
             'file': file.read(),
             'file_name': file.filename,
             'file_type': file.content_type,
         }, request.context)

         return 'window.top.%s(%s)' % (
             jsonp, simplejson.dumps({'result': written}))

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.