forked from GoogleChrome/chromium-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bulkloader_helpers.py
29 lines (24 loc) · 955 Bytes
/
bulkloader_helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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