Implemented caching for API calls

Introduced new decorators:
 * response - responsible for parameters processing
 * cached - get/set to cache
Removed all search functionality in API methods.
Fixed logging.

implements bp cache-api-methods

Change-Id: I91d36424a36442a09591c140e9f22401139b7415
This commit is contained in:
Ilya Shakhat
2014-05-21 14:32:34 +04:00
parent 68ecbf6db1
commit f36fd65ab2
10 changed files with 235 additions and 202 deletions

View File

@@ -42,7 +42,7 @@ def date_to_timestamp(d):
def date_to_timestamp_ext(d):
try:
return date_to_timestamp(d)
except ValueError:
except (ValueError, TypeError):
return int(d)
@@ -72,6 +72,10 @@ def timestamp_to_day(timestamp):
return timestamp // (24 * 3600)
def round_timestamp_to_day(timestamp):
return (int(timestamp) // (24 * 3600)) * (24 * 3600)
def check_email_validity(email):
if email:
return re.match(r'[\w\d_\.-]+@([\w\d_\.-]+\.)+[\w]+', email)