Ejemplo n.º 1
0
 def handle(self,*args,**kwargs):
   import _populate_db
   try:
     _populate_db.main(*args,**kwargs)
     subject = "[grondview] Data incorporated successfully into the database"
     body = 'Thanks for your contribution!'
   except Exception, e:
     subject = "[grondview] Error: All data were not loaded into the database"
     body = "{}".format(traceback.format_exc())
     print self.help
     print body
     raise
Ejemplo n.º 2
0
 def handle(self,*args,**kwargs):
   import _populate_db
   try:
     _populate_db.main(*args,**kwargs)
     subject = "[grondview] Data incorporated successfully into the database"
     body = 'Thanks for your contribution!'
   except:
     subject = "[grondview] Error: All data were not loaded into the database"
     body = 'Sorry!'
     print self.help
     raise
   finally:
     if kwargs['email']:
       send_mail(subject, body, DEFAULT_FROM_EMAIL,[kwargs['email'],'*****@*****.**'], fail_silently=False)
     lockfile = os.path.join(PROJECT_ROOT,'populateDB.lock')
     if os.path.isfile(lockfile):
       with open(lockfile,'r') as f:
         pid = int(f.read())
       if pid == os.getpid():
         os.unlink(lockfile)