from google.appengine.ext import db
from datetime import date,datetime,time
def deleteArea(area, x):
"""
Find and delete all objects belonging to 'area'. Delete should
bail out if
1. the business Subscription is not 'TRIAL' 2. the business is in
a 'TRIAL' state and x days have elapsed.
Return True if all objects could be successfully deleted. False
otherwise.
"""
#Entity_Kind =
['ACLRules','WTBusiness','WTComment','WTContact',.....]
#
#for each entity_kind in Entity_Kind :
#
# if(Subscription of business is not TRIAL):
# return False
# if(Subscription of business is TRIAL AND (current_date-
sign_in_date) == x )):
# return False
# else :
# filter each entity_kind.all() by area ,fetch and delete
it.
# return True
#
Entity_Kind =
['ACLRules','WTBusiness','WTComment','WTContact','WTForum','WTMailTemplate','WTPost','WTTicket','WTTopic','WTUser']
e = WTBusiness.all()
e.filter('area= ', area)
business = e.get()
if(business.Subscription != 'TRIAL'):
t = abs(datetime.datetime.now()-WTBusiness.created).days
if(t<x):
return True
for entity_kind in Entity_Kind :
e = entity_kind.all()
e.filter('area= ', area)
results = e.fetch(e)
db.delete(results)
return True
pass
--------------------------------------------------------------------------------------------------------------------------------------
guys , have tried something like this .
Any help ??
Thanks ,
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.