Merge lp:~0k.io/openobject-server/correct-syntax-error-default-view-for-base-calendar into lp:openobject-server

Proposed by Valentin Lab
Status: Needs review
Proposed branch: lp:~0k.io/openobject-server/correct-syntax-error-default-view-for-base-calendar
Merge into: lp:openobject-server
Diff against target: 12 lines (+1/-1)
1 file modified
openerp/osv/orm.py (+1/-1)
To merge this branch: bzr merge lp:~0k.io/openobject-server/correct-syntax-error-default-view-for-base-calendar
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+169482@code.launchpad.net

Description of the change

Without this modification, the given code will cast a syntax error. SubElement method does not support *args but only **kwargs after the second argument:

api of subelement:

  http://lxml.de/api/lxml.etree-module.html

in short, here's the prototype as of the later link:

  SubElement(_parent, _tag, attrib=None, nsmap=None, **_extra)

So, you can't provide a third non-keyword argument (or else it'll be taken as ``attrib``, which is required to be a dict, not a string).

Read the bug report associated, and if any doubt, lookup other calls in the same file of SubElements.

To post a comment you must log in.

Unmerged revisions

4901. By Valentin Lab

[FIX] syntax error in default calendar view creation.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/osv/orm.py'
2--- openerp/osv/orm.py 2013-06-10 15:06:57 +0000
3+++ openerp/osv/orm.py 2013-06-14 16:17:33 +0000
4@@ -2008,7 +2008,7 @@
5 return False
6
7 view = etree.Element('calendar', string=self._description)
8- etree.SubElement(view, 'field', self._rec_name_fallback(cr, user, context))
9+ etree.SubElement(view, 'field', name=self._rec_name_fallback(cr, user, context))
10
11 if self._date_name not in self._columns:
12 date_found = False