Exemplo n.º 1
0
def send_email(*args, **kwargs):
    try:
        from kitchenrock_api.services.email import EmailService
        EmailService.sm_do_send(**args[0])
    except Exception as e:
        print("Unable to sending email: " + str(e))
        Utils.log_exception(e)
Exemplo n.º 2
0
 def save(self, data, return_http=True):
     try:
         if 'is_active' not in data:
             data['is_active'] = False
         serializer = self.user_serialiser_class(data=data)
         serializer.is_valid(raise_exception=True)
         serializer.save()
         return Response(serializer.data)
     except Exception as e:
         Utils.log_exception(e)
         raise e
Exemplo n.º 3
0
 def async_job(cls, job_name, fname, args, delayed_time = 0):
     try:
         # Async class instance example
         from django_q.tasks import Async
         # instantiate an async task
         a = Async(fname, args, group=job_name)
         # you can set or change keywords afterwards
         a.cached = True
         # run it
         a.run()
         return True
     except Exception as e:
         Utils.log_exception(e)
         return None