Skip to content

Commit

Permalink
Merge pull request #1327 from leonelcamara/ditch26
Browse files Browse the repository at this point in the history
Ditch python2.6
  • Loading branch information
mdipierro committed May 11, 2016
2 parents 5246d80 + 261da3e commit be1845a
Show file tree
Hide file tree
Showing 39 changed files with 65 additions and 1,919 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -7,7 +7,6 @@ cache:
- $HOME/.pip-cache/

python:
- '2.6'
- '2.7'
- 'pypy'

Expand All @@ -29,7 +28,6 @@ install:


before_script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install --download-cache $HOME/.pip-cache unittest2; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --download-cache $HOME/.pip-cache coverage; fi;
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --download-cache $HOME/.pip-cache codecov; fi
- mysql -e 'create database pydal;'
Expand Down
19 changes: 0 additions & 19 deletions LICENSE
Expand Up @@ -39,25 +39,6 @@ web2py contains third party software under the gluon/contrib/ folder.
Each file/module in contrib is distributed with web2py under its original license.
Here we list some of them.

#### gluon.contrib.simplejson LICENSE

Copyright (c) 2006 Bob Ippolito - Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

#### gluon.contrib.rss2.py (originally PyRSS2Gen) LICENSE

This is copyright (c) by Dalke Scientific Software, LLC and released under the
Expand Down
19 changes: 0 additions & 19 deletions applications/admin/LICENSE
Expand Up @@ -39,25 +39,6 @@ web2py contains third party software under the gluon/contrib/ folder.
Each file/module in contrib is distributed with web2py under its original license.
Here we list some of them.

#### gluon.contrib.simplejson LICENSE

Copyright (c) 2006 Bob Ippolito - Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

#### gluon.contrib.rss2.py (originally PyRSS2Gen) LICENSE

This is copyright (c) by Dalke Scientific Software, LLC and released under the
Expand Down
2 changes: 1 addition & 1 deletion applications/admin/controllers/wizard.py
Expand Up @@ -80,7 +80,7 @@ def index():


def step1():
from gluon.contrib.simplejson import loads
from json import loads
import urllib
if not session.themes:
#url = LAYOUTS_APP + '/default/layouts.json'
Expand Down
3 changes: 1 addition & 2 deletions applications/examples/controllers/simple_examples.py
Expand Up @@ -56,8 +56,7 @@ def servejs():
return 'alert("This is a Javascript document, it is not supposed to run!");'

def makejson():
import gluon.contrib.simplejson as sj
return sj.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
return response.json(['foo', {'bar': ('baz', None, 1.0, 2)}])


def makertf():
Expand Down
2 changes: 1 addition & 1 deletion applications/examples/views/default/examples.html
Expand Up @@ -134,7 +134,7 @@ <h3 id="example_json">Example {{=c}}{{c+=1}}</h3><b>In controller: simple_exampl
def makejson():
return response.json(['foo', {'bar': ('baz', None, 1.0, 2)}])
""".strip(),language='web2py',link=URL('global','vars'),_class='boxCode')}}
<p>If you are into Ajax, web2py includes gluon.contrib.<a href="http://cheeseshop.python.org/pypi/simplejson">simplejson</a>, developed by Bob Ippolito. This module provides a fast and easy way to serve asynchronous content to your Ajax page. gluon.simplesjson.dumps(...) can serialize most Python types into <a href="http://www.json.org">JSON</a>. gluon.contrib.simplejson.loads(...) performs the reverse operation.
<p>If you are into Ajax, <a href="http://www.json.org">JSON</a> is fully supported in web2py. Providing a fast and easy way to serve asynchronous content to your Ajax page. Response.json can serialize most Python types into JSON.
<br/>Try it here: <a class="btn" href="/{{=request.application}}/simple_examples/makejson">makejson</a></p>

<p>New in web2py 1.63: Any normal action returning a dict is automatically serialized in JSON if '.json' is appended to the URL.</p>
Expand Down
3 changes: 1 addition & 2 deletions applications/examples/views/default/who.html
Expand Up @@ -149,8 +149,7 @@ <h3>

<li><a href="http://www.python.org">Python</a> created by Guido van Rossum.</li>
<li>Rocket Web Server developed by Timothy Farrell.</li>
<li><a href="http://codemirror.net/">CodeMirror</a></li>
<li><a href="http://cheeseshop.python.org/pypi/simplejson">simplejson</a> developed by Bob Ippolito</li>
<li><a href="http://codemirror.net/">CodeMirror</a></li>s
<li><a href="http://pyrtf.sourceforge.net/">PyRTF</a> developed by Simon Cusack and revised by Grant Edwards</li>
<li><a href="http://www.dalkescientific.com/Python/PyRSS2Gen.html">PyRSS2Gen</a> developed by Dalke Scientific Software</li>
<li><a href="http://www.feedparser.org/">feedparser</a> developed by Mark Pilgrim</li>
Expand Down
6 changes: 2 additions & 4 deletions gluon/cache.py
Expand Up @@ -33,10 +33,8 @@
from gluon import recfile
from gluon import portalocker
from collections import defaultdict
try:
from collections import OrderedDict
except ImportError:
from gluon.contrib.ordereddict import OrderedDict
from collections import OrderedDict

try:
from gluon import settings
have_settings = True
Expand Down
4 changes: 2 additions & 2 deletions gluon/contrib/appconfig.py
Expand Up @@ -31,7 +31,7 @@
import os
from ConfigParser import SafeConfigParser
from gluon import current
from gluon.serializers import json_parser
import json

locker = thread.allocate_lock()

Expand Down Expand Up @@ -132,7 +132,7 @@ def read_config_ini(self):

def read_config_json(self):
with open(self.file, 'r') as c:
self.settings = AppConfigDict(json_parser.load(c))
self.settings = AppConfigDict(json.load(c))

def read_config(self):
if self.settings is None:
Expand Down
2 changes: 1 addition & 1 deletion gluon/contrib/autolinks.py
Expand Up @@ -45,7 +45,7 @@
import re
import cgi
import sys
from simplejson import loads
from json import loads
import urllib
import uuid
try:
Expand Down
2 changes: 1 addition & 1 deletion gluon/contrib/login_methods/browserid_account.py
Expand Up @@ -23,7 +23,7 @@
from gluon import *
from gluon.storage import Storage
from gluon.tools import fetch
import gluon.contrib.simplejson as json
import json


class BrowserID(object):
Expand Down
1 change: 0 additions & 1 deletion gluon/contrib/login_methods/dropbox_account.py
Expand Up @@ -16,7 +16,6 @@
from gluon import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json


class DropboxAccount(object):
Expand Down
2 changes: 1 addition & 1 deletion gluon/contrib/login_methods/janrain_account.py
Expand Up @@ -17,7 +17,7 @@
from gluon import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
import json


class RPXAccount(object):
Expand Down
5 changes: 2 additions & 3 deletions gluon/contrib/login_methods/loginradius_account.py
Expand Up @@ -13,9 +13,8 @@
import os
from gluon import *
from gluon.storage import Storage
from gluon.contrib.simplejson import JSONDecodeError
from gluon.tools import fetch
import gluon.contrib.simplejson as json
import json


class LoginRadiusAccount(object):
Expand Down Expand Up @@ -64,7 +63,7 @@ def get_user(self):
provider = self.profile['Provider']
mapping = self.mappings.get(provider, self.mappings['default'])
user = mapping(self.profile)
except (JSONDecodeError, KeyError):
except (ValueError, KeyError):
pass
if user is None and self.on_login_failure:
redirect(self.on_login_failure)
Expand Down
8 changes: 4 additions & 4 deletions gluon/contrib/login_methods/loginza.py
Expand Up @@ -11,7 +11,7 @@
from gluon.html import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
import json


class Loginza(object):
Expand Down Expand Up @@ -84,15 +84,15 @@ def get_user(self):
user = Storage()
data = urllib.urlencode(dict(token=request.vars.token))
auth_info_json = fetch(self.auth_url + '?' + data)
#print auth_info_json
# print auth_info_json
auth_info = json.loads(auth_info_json)
if auth_info["identity"] is not None:
self.profile = auth_info
provider = self.profile["provider"]
user = self.mappings.get(
provider, self.mappings.default)(self.profile)
#user["password"] = ???
#user["avatar"] = ???
# user["password"] = ???
# user["avatar"] = ???
return user
elif self.on_login_failure:
redirect(self.on_login_failure)
Expand Down
5 changes: 2 additions & 3 deletions gluon/contrib/login_methods/oneall_account.py
Expand Up @@ -14,9 +14,8 @@
import base64
from gluon import *
from gluon.storage import Storage
from gluon.contrib.simplejson import JSONDecodeError
from gluon.tools import fetch
import gluon.contrib.simplejson as json
import json

class OneallAccount(object):

Expand Down Expand Up @@ -76,7 +75,7 @@ def get_user(self):
source = self.profile['source']['key']
mapping = self.mappings.get(source,self.mappings['default'])
user = mapping(self.profile)
except (JSONDecodeError, KeyError):
except (ValueError, KeyError):
pass
if user is None and self.on_login_failure:
redirect(self.on_login_failure)
Expand Down
2 changes: 1 addition & 1 deletion gluon/contrib/login_methods/rpx_account.py
Expand Up @@ -17,7 +17,7 @@
from gluon import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
import json


class RPXAccount(object):
Expand Down
132 changes: 6 additions & 126 deletions gluon/contrib/ordereddict.py
@@ -1,127 +1,7 @@
# Copyright (c) 2009 Raymond Hettinger
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# -*- coding: utf-8 -*-
"""
Dummy ordereddict module for backwards compatibility with applications that import OrderedDict from gluon.contrib.ordereddict
from UserDict import DictMixin

class OrderedDict(dict, DictMixin):

def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.update(*args, **kwds)

def clear(self):
self.__end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self)

def __setitem__(self, key, value):
if key not in self:
end = self.__end
curr = end[1]
curr[2] = end[1] = self.__map[key] = [key, curr, end]
dict.__setitem__(self, key, value)

def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next
next[1] = prev

def __iter__(self):
end = self.__end
curr = end[2]
while curr is not end:
yield curr[0]
curr = curr[2]

def __reversed__(self):
end = self.__end
curr = end[1]
while curr is not end:
yield curr[0]
curr = curr[1]

def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value

def __reduce__(self):
items = [[k, self[k]] for k in self]
tmp = self.__map, self.__end
del self.__map, self.__end
inst_dict = vars(self).copy()
self.__map, self.__end = tmp
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)

def keys(self):
return list(self)

setdefault = DictMixin.setdefault
update = DictMixin.update
pop = DictMixin.pop
values = DictMixin.values
items = DictMixin.items
iterkeys = DictMixin.iterkeys
itervalues = DictMixin.itervalues
iteritems = DictMixin.iteritems

def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())

def copy(self):
return self.__class__(self)

@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d

def __eq__(self, other):
if isinstance(other, OrderedDict):
if len(self) != len(other):
return False
for p, q in zip(self.items(), other.items()):
if p != q:
return False
return True
return dict.__eq__(self, other)

def __ne__(self, other):
return not self == other
TODO: Remove this.
"""
from collections import OrderedDict

0 comments on commit be1845a

Please sign in to comment.