You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
4.2 KiB
132 lines
4.2 KiB
17 years ago
|
Patch by Robert Scheck <robert@fedoraproject.org> which makes boto >= 1.2a working by
|
||
|
using the older Python 2.3, that doesn't support the non-decorator syntax, which is used
|
||
|
at @staticmethod, @classmethod and @assert_case_insensitive.
|
||
|
|
||
|
--- boto-1.2a/boto/s3/connection.py 2008-04-15 02:24:29.000000000 +0200
|
||
|
+++ boto-1.2a/boto/s3/connection.py.python23 2008-05-07 23:22:05.000000000 +0200
|
||
|
@@ -62,14 +62,14 @@
|
||
|
return '/%s' % urllib.quote_plus(key)
|
||
|
|
||
|
class SubdomainCallingFormat(_CallingFormat):
|
||
|
- @assert_case_insensitive
|
||
|
def get_bucket_server(self, server, bucket):
|
||
|
return '%s.%s' % (bucket, server)
|
||
|
+ get_bucket_server = assert_case_insensitive(get_bucket_server)
|
||
|
|
||
|
class VHostCallingFormat(_CallingFormat):
|
||
|
- @assert_case_insensitive
|
||
|
def get_bucket_server(self, server, bucket):
|
||
|
return bucket
|
||
|
+ get_bucket_server = assert_case_insensitive(get_bucket_server)
|
||
|
|
||
|
class OrdinaryCallingFormat(_CallingFormat):
|
||
|
def get_bucket_server(self, server, bucket):
|
||
|
--- boto-1.2a/boto/mashups/server.py 2008-04-10 18:35:30.000000000 +0200
|
||
|
+++ boto-1.2a/boto/mashups/server.py.python23 2008-05-07 23:12:13.000000000 +0200
|
||
|
@@ -58,7 +58,6 @@
|
||
|
|
||
|
ec2 = boto.connect_ec2()
|
||
|
|
||
|
- @classmethod
|
||
|
def Inventory(cls):
|
||
|
"""
|
||
|
Returns a list of Server instances, one for each Server object
|
||
|
@@ -69,8 +68,8 @@
|
||
|
for server in rs:
|
||
|
l.append(server)
|
||
|
return l
|
||
|
+ Inventory = classmethod(Inventory)
|
||
|
|
||
|
- @classmethod
|
||
|
def Register(cls, name, instance_id, description=''):
|
||
|
s = cls()
|
||
|
s.name = name
|
||
|
@@ -78,6 +77,7 @@
|
||
|
s.description = description
|
||
|
s.save()
|
||
|
return s
|
||
|
+ Register = classmethod(Register)
|
||
|
|
||
|
def __init__(self, id=None):
|
||
|
SDBObject.__init__(self, id)
|
||
|
--- boto-1.2a/boto/sdb/persist/object.py 2008-03-22 16:54:36.000000000 +0100
|
||
|
+++ boto-1.2a/boto/sdb/persist/object.py.python23 2008-05-07 23:14:59.000000000 +0200
|
||
|
@@ -44,13 +44,12 @@
|
||
|
class SDBObject(object):
|
||
|
__metaclass__ = SDBBase
|
||
|
|
||
|
- @classmethod
|
||
|
def get_lineage(cls):
|
||
|
l = [c.__name__ for c in cls.mro()]
|
||
|
l.reverse()
|
||
|
return '.'.join(l)
|
||
|
+ get_lineage = classmethod(get_lineage)
|
||
|
|
||
|
- @classmethod
|
||
|
def get(cls, id=None, **params):
|
||
|
domain = get_domain()
|
||
|
if domain and id:
|
||
|
@@ -70,8 +69,8 @@
|
||
|
except StopIteration:
|
||
|
return obj
|
||
|
raise SDBPersistanceError('Query matched more than 1 item')
|
||
|
+ get = classmethod(get)
|
||
|
|
||
|
- @classmethod
|
||
|
def find(cls, **params):
|
||
|
keys = params.keys()
|
||
|
if len(keys) > 4:
|
||
|
@@ -97,8 +96,8 @@
|
||
|
else:
|
||
|
rs = []
|
||
|
return object_lister(None, rs)
|
||
|
+ find = classmethod(find)
|
||
|
|
||
|
- @classmethod
|
||
|
def list(cls, max_items=None):
|
||
|
domain = get_domain()
|
||
|
if domain:
|
||
|
@@ -106,8 +105,8 @@
|
||
|
else:
|
||
|
rs = []
|
||
|
return object_lister(cls, rs)
|
||
|
+ list = classmethod(list)
|
||
|
|
||
|
- @classmethod
|
||
|
def find_properties(cls):
|
||
|
properties = []
|
||
|
while cls:
|
||
|
@@ -119,6 +118,7 @@
|
||
|
else:
|
||
|
cls = None
|
||
|
return properties
|
||
|
+ find_properties = classmethod(find_properties)
|
||
|
|
||
|
def __init__(self, id=None):
|
||
|
self.id = id
|
||
|
--- boto-1.2a/boto/mturk/connection.py 2008-04-10 18:35:32.000000000 +0200
|
||
|
+++ boto-1.2a/boto/mturk/connection.py.python23 2008-05-07 23:06:59.000000000 +0200
|
||
|
@@ -170,7 +170,6 @@
|
||
|
else:
|
||
|
raise EC2ResponseError(response.status, response.reason, body)
|
||
|
|
||
|
- @staticmethod
|
||
|
def get_keywords_as_string(keywords):
|
||
|
"""
|
||
|
Returns a comma+space-separated string of keywords from either a list or a string
|
||
|
@@ -184,8 +183,8 @@
|
||
|
else:
|
||
|
raise TypeError("keywords argument must be a string or a list of strings; got a %s" % type(keywords))
|
||
|
return final_keywords
|
||
|
+ get_keywords_as_string = staticmethod(get_keywords_as_string)
|
||
|
|
||
|
- @staticmethod
|
||
|
def get_price_as_price(reward):
|
||
|
"""
|
||
|
Returns a Price data structure from either a float or a Price
|
||
|
@@ -195,3 +194,4 @@
|
||
|
else:
|
||
|
final_price = Price(reward)
|
||
|
return final_price
|
||
|
+ get_price_as_price = staticmethod(get_price_as_price)
|