30 строки
955 B
Python
30 строки
955 B
Python
import datetime
|
|
|
|
from google.appengine.ext import db
|
|
from google.appengine.api import users
|
|
|
|
|
|
def email_to_list():
|
|
def wrapper(value):
|
|
if value == '' or value is None or value == []:
|
|
return None
|
|
return [db.Email(x.strip()) for x in value.split(',')]
|
|
|
|
return wrapper
|
|
|
|
def finalize(input_dict, instance, bulkload_state_copy):
|
|
#print input_dict
|
|
if instance['owner'] is None:
|
|
del instance['owner']
|
|
if instance['created'] is None:
|
|
instance['created'] = datetime.datetime.utcnow()
|
|
if instance['updated'] is None:
|
|
instance['updated'] = datetime.datetime.utcnow()
|
|
if instance['created_by'] is None:
|
|
instance['created_by'] = users.User(email='admin') #users.get_current_user().email()
|
|
if instance['updated_by'] is None:
|
|
instance['updated_by'] = users.User(email='admin') #users.get_current_user().email()
|
|
if instance['summary'] == '' or instance['summary'] is None:
|
|
instance['summary'] = ' '
|
|
return instance
|