This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
transaction_id = "6b836698-4f76-4c56-8022-8f26734bea2a" | |
app_code = "AED" | |
user_id = "courting79" | |
hash_key = "[already provided to you]" | |
print hashlib.md5("%s_%s_%s_%s" % (transaction_id, app_code, user_id, hash_key)).hexdigest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def serialize_from_db_type(cls,val): | |
functions = { google.appengine.ext.db.BooleanProperty : serialize_db_type_boolean, | |
google.appengine.ext.db.ListProperty : serialize_db_type_list, | |
google.appengine.ext.db.FloatProperty : serialize_db_type_numeric, | |
google.appengine.ext.db.IntegerProperty : serialize_db_type_numeric, | |
google.appengine.ext.db.StringProperty : serialize_db_type_string, | |
google.appengine.ext.db.DateTimeProperty : serialize_db_type_datetime, | |
google.appengine.ext.db.TextProperty : serialize_db_type_string, | |
google.appengine.ext.db.DateProperty : serialize_db_type_date | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from paymentez.models.expense import Expense | |
from paymentez.models.paymentez_user import PaymentezUser | |
from google.appengine.api.labs import taskqueue | |
from google.appengine.api.labs.taskqueue import TransientError | |
ids = [] | |
def process_exp(exp,start,repeated): | |
counter = start | |
repeated = repeated | |
for e in exp: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_infinite_numbers(start): | |
while True: | |
yield start | |
start += 1 | |
# You can use it directly but put a limit | |
start = 3 | |
limit = 10 | |
for number in get_infinite_numbers(start): | |
print number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.filters = [] | |
approved_filter = {'property' : 'approved', | |
'condition' : '=', | |
'value' : True} | |
def add_filter(filter): | |
self.filters.append(filter) | |
def apply_filters(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retry_on_timeout(retries=4, secs=1): | |
"""A decorator to retry a given function performing db operations.""" | |
def _decorator(func): | |
def _wrapper(*args, **kwds): | |
tries = 0 | |
while True: | |
try: | |
tries += 1 | |
return func(*args, **kwds) | |
except (db.Timeout,Timeout), e: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = 0 | |
end = 50 | |
while keep: | |
try: | |
db.put(trans[start:end]) | |
except: | |
db.put(trans[start:end]) | |
start = end | |
end += 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = 0 | |
end = 50 | |
keep = True | |
while keep: | |
try: | |
db.put(trans[start:end]) | |
except: | |
db.put(trans[start:end]) | |
start = end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ts2 = ["E4B17DFFCBC946C0AFE76015965B0556", | |
"9D3C345A3DFB41DBBD711A490300E15C", | |
"719D7A608E3249998B1EFE5DB208611A", | |
"61B0A02031C642F48D75C9941576964D", | |
"90A6544D45874A1F96F4677F8899278C", | |
"9823CEB23C9143498515BB5B297260B6", | |
"0BDBC1376CB64004A2C12949B111E3C8", | |
"38BF6FCC65A44BA6B7AFCF0E132C7704", | |
"5E34DDFE1A3A4DBAA69C0D256920883C", | |
"5F764F199B7849C9A3EE2E5B08DBF2BD", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ts = ["48F7975726EE4262BDDBD86DA9EBE312", | |
"7DCAF69EBE914AED971C823D790A29BF", | |
"8A3D066A798F4AA7BE29603C276F1C7E", | |
"3207DC8022E64772A8CF1F5CC63A215A", | |
"1F65E012932C456A852D7898C48D65DF", | |
"92FC15F5C63B487DA101944B49CE64AB", | |
"685F15C0533046A0870BF4DA2F3F82E5", | |
"C849FC9FAEBF4F41932BA2D781303D67", | |
"E6ACD9CC11734E70AE9AD67538057EC9", | |
"298A2B1EF2AA4274825DAF9FE95A3982", |