Skip to content

Commit

Permalink
Adding a sorted() method for ancient pythons
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjarni R. Einarsson committed May 4, 2011
1 parent 3e78794 commit 57e4dec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pagekite.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,22 @@
except ImportError:
pass


# Backwards compatibility for old Pythons.
if not 'SHUT_RD' in dir(socket):
socket.SHUT_RD = 0
socket.SHUT_WR = 1
socket.SHUT_RDWR = 2

try:
sorted([1, 2, 3])
except:
def sorted(l):
tmp = l[:]
tmp.sort()
return tmp


# SSL/TLS strategy: prefer pyOpenSSL, as it comes with built-in Context
# objects. If that fails, look for Python 2.6+ native ssl support and
# create a compatibility wrapper. If both fail, bomb with a ConfigError
Expand Down Expand Up @@ -596,7 +607,6 @@ def run(self): pass
YamonD=MockYamonD



##[ PageKite.py code starts here! ]############################################

gSecret = None
Expand Down

0 comments on commit 57e4dec

Please sign in to comment.