← Back to team overview

openerp-community team mailing list archive

Re: OCA guidelines for code compatibility with Python 2.6

 

Eric, Stéphane,

maybe we are talking about different things: I was referring to string
literals (and making the suggestion of unicode_literals if we drop
py2.6 to avoid forgetting all the u'')

The actual encoding of the python code doesn't worry me too much, as
is should be relevant mostly only for contributor names in the headers
(and my name doesn't have any accents, even though many add an é to it
:)

On Tue, Feb 25, 2014 at 10:36 AM, Stéphane Wirtel <stw@xxxxxxxxxxx> wrote:
> Why in Unicode?
>
>
>
> On 25 Feb 2014, at 10:34, Eric Caudal wrote:
>
>> All openerp code should be Unicode compatible by default!
>> (and this is still not the case... eg: filenames)
>>
>> Eric CAUDAL
>>
>> Eric Caudal
>> /CEO/
>> --
>> *Elico Corporation, Shanghai branch
>> /OpenERP Premium Certified Training Partner/  *
>>
>> Cell: + 86 186 2136 1670
>> Office: + 86 21 6211 8017/27/37
>> Skype: elico.corp
>> eric.caudal@xxxxxxxxxxxxxx  <mailto:eric.caudal@xxxxxxxxxxxxxx>
>> http://www.elico-corp.com
>>
>>
>> Elico Corp
>> On 02/25/2014 05:22 PM, Leonardo Pistone wrote:
>>>
>>> A sidenote on bytestrings/unicode (typically the biggest headache in
>>> py2 -> py3 ports).
>>>
>>> Python 3 or not, I once lost a few hours of sleep because we all
>>> define field descriptions with plain quotes (thus, in py2,
>>> bytestrings), but the translation system actually returns unicode.
>>> That was maybe 6.1, but I guess it is still like that.
>>>
>>> In theory, in a functional addon (inside the framework things get more
>>> complicated) we should probably handle unicode only, letting the
>>> framework do the right encoding/decoding up the stack.
>>>
>>> I find this a bad practice, and IMHO something like from __future__
>>> import unicode_literals could force us to do that.
>>>
>>> On Tue, Feb 25, 2014 at 8:04 AM, Alexandre Fayolle
>>> <alexandre.fayolle@xxxxxxxxxxxxxx> wrote:
>>>>
>>>> On 24/02/2014 17:00, Daniel Reis wrote:
>>>>
>>>> Hi all,
>>>>
>>>> In a merge proposal for 7.0. came up the question of what Python
>>>> versions
>>>> should the code be compatible with.
>>>>
>>>> In particular, a dictionay comprehension is used the, available in
>>>> Python
>>>> 2.7 but not compatible with Python 2.6.
>>>> For reference, the MP is:
>>>>
>>>> https://code.launchpad.net/~dreis-pt/project-service/7.0-issue_task-dr/+merge/195985
>>>>
>>>> So, the question here is:
>>>> Regarding OCA reviewed modules, should the code targeting OpenERP >= 7.0
>>>> be
>>>> made to keep Python 2.6 compatibility?
>>>>
>>>> Regards
>>>>
>>>> Daniel Reis
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~openerp-community
>>>> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~openerp-community
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>> I'm not sure OpenERP 7 can run on Python 2.6 (but I could well be deeply
>>>> mistaken).
>>>>
>>>> I really wish we could mandate targetting Python 2.7 for OCA modules and
>>>> take advantage of the additions brought by that release. It is nowadays
>>>> fairly easy to get a python2.7 interpreter even if your distro does not
>>>> provide one (virtualenv). We should also gently nag people about using
>>>> the
>>>> __future__ imports designed to ease porting to Python 3.x.  The idea
>>>> behind
>>>> this is not to block useful modules but to start getting contributors in
>>>> the
>>>> mood for the change. This will save grief later.
>>>>
>>>> --
>>>> Alexandre Fayolle
>>>> Chef de Projet
>>>> Tel : + 33 (0)4 79 26 57 94
>>>>
>>>> Camptocamp France SAS
>>>> Savoie Technolac, BP 352
>>>> 73377 Le Bourget du Lac Cedex
>>>> http://www.camptocamp.com
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~openerp-community
>>>> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~openerp-community
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~openerp-community
>>> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~openerp-community
>>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openerp-community
>> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~openerp-community
>> More help   : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References