Drop support of Python 2.6

review2681004
This commit is contained in:
C?dric Krier 2014-01-31 00:05:43 +01:00
parent 5d6230da99
commit c90e93469e
8 changed files with 8 additions and 75 deletions

View file

@ -1,3 +1,4 @@
* Drop support of Python 2.6
* Allow to search on rec_name of Reference fields
* Use local timezone
* Sanitize report file extension

View file

@ -4,11 +4,10 @@ Installing tryton
Prerequisites
-------------
* Python 2.6 or later (http://www.python.org/)
* Python 2.7 or later (http://www.python.org/)
* pygtk 2.22 or later (http://www.pygtk.org/)
* librsvg (http://librsvg.sourceforge.net/)
* python-dateutil (http://labix.org/python-dateutil)
* weakrefset for Python 2.6 (https://code.google.com/p/weakrefset/)
* Optional: simplejson (http://undefined.org/python/#simplejson)
* Optional: cdecimal (http://www.bytereef.org/mpdecimal/index.html)
* Optional: GooCalendar (http://code.google.com/p/goocalendar/)

View file

@ -120,10 +120,6 @@ elif sys.platform == 'darwin':
execfile(os.path.join('tryton', 'version.py'))
WEAKREF = []
if sys.version_info < (2, 7):
WEAKREF = ['weakrefset']
dist = setup(name=PACKAGE,
version=VERSION,
description='Tryton client',
@ -154,7 +150,6 @@ dist = setup(name=PACKAGE,
'Natural Language :: Slovenian',
'Natural Language :: Japanese',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Office/Business',
],
@ -162,7 +157,7 @@ dist = setup(name=PACKAGE,
install_requires=[
#"pygtk >= 2.6",
"python-dateutil",
] + WEAKREF,
],
extras_require={
'simplejson': ['simplejson'],
'cdecimal': ['cdecimal'],

View file

@ -9,7 +9,7 @@ from decimal import Decimal
import datetime
import time
import io
import collections
from collections import OrderedDict
from tryton.translate import date_format
from tryton.common import untimezoned_date, datetime_strftime
@ -774,11 +774,7 @@ class DomainParser(object):
"A parser for domain"
def __init__(self, fields):
if hasattr(collections, 'OrderedDict'):
odict = collections.OrderedDict
else:
odict = dict
self.fields = odict((name, f)
self.fields = OrderedDict((name, f)
for name, f in fields.iteritems()
if f.get('searchable', True))
self.strings = dict((f['string'].lower(), f)

View file

@ -1,9 +1,6 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
try:
from weakref import WeakSet
except ImportError:
from weakrefset import WeakSet
from weakref import WeakSet
from record import Record
from field import Field, O2MField

View file

@ -126,11 +126,8 @@ class Screen(SignalEvent):
xml_fields = [node_attributes(node).get('name')
for node in root_node.childNodes
if node.nodeName == 'field']
if hasattr(collections, 'OrderedDict'):
odict = collections.OrderedDict
else:
odict = dict
fields = odict((name, fields[name]) for name in xml_fields)
fields = collections.OrderedDict(
(name, fields[name]) for name in xml_fields)
for name, string, type_ in (
('id', _('ID'), 'integer'),
('create_uid', _('Creation User'), 'many2one'),

View file

@ -4,7 +4,6 @@ import gtk
import gettext
import operator
import gobject
import collections
import tryton.common as common
from tryton.common.domain_parser import quote
@ -434,10 +433,6 @@ class ScreenContainer(object):
vbox = gtk.VBox()
fields = [f for f in self.screen.domain_parser.fields.itervalues()
if f.get('searchable', True)]
if (not hasattr(collections, 'OrderedDict')
or not isinstance(self.screen.domain_parser.fields,
collections.OrderedDict)):
fields.sort(key=operator.itemgetter('string'))
self.search_table = gtk.Table(rows=len(fields), columns=2)
self.search_table.set_homogeneous(False)
self.search_table.set_border_width(5)

View file

@ -13,7 +13,6 @@ import socket
import gzip
import StringIO
import hashlib
import sys
import base64
__all__ = ["ResponseError", "Fault", "ProtocolError", "Transport",
@ -228,52 +227,6 @@ class Transport(xmlrpclib.Transport, xmlrpclib.SafeTransport):
self._connection[1].sock.settimeout(DEFAULT_TIMEOUT)
return self._connection[1]
if sys.version_info[:2] <= (2, 6):
def request(self, host, handler, request_body, verbose=0):
h = self.make_connection(host)
if verbose:
h.set_debuglevel(1)
self.send_request(h, handler, request_body)
self.send_host(h, host)
self.send_user_agent(h)
self.send_content(h, request_body)
response = h.getresponse()
if response.status != 200:
raise ProtocolError(
host + handler,
response.status,
response.reason,
response.getheaders()
)
self.verbose = verbose
try:
sock = h._conn.sock
except AttributeError:
sock = None
if response.getheader("Content-Encoding", "") == "gzip":
response = gzip.GzipFile(mode="rb",
fileobj=StringIO.StringIO(response.read()))
sock = None
return self._parse_response(response, sock)
def send_request(self, connection, handler, request_body):
xmlrpclib.Transport.send_request(self, connection, handler,
request_body)
connection.putheader("Accept-Encoding", "gzip")
def close(self):
if self._connection[1]:
self._connection[1].close()
self._connection = (None, None)
class ServerProxy(xmlrpclib.ServerProxy):
__id = 0