def email(self,format='html',id='',**kw): site = request.environ['site'] class email(RestApiMethod): def get(self, **kw): return render('/api/email.xml') def post(self, **kw): return 'not implemented' def put(self, **kw): return 'not implemented' def delete(self, **kw): return 'not implemented' if id != '' and id != None: c.emailtemplates = Email.by_key(site_id=site.id,key=id) if c.emailtemplates: c.item = c.emailtemplates c.emailtemplates = [c.item] else: c.emailtemplates = Email.all(site_id=site.id) if not c.emailtemplates: log.info('no email templates? Should be site=%s' % site) c.emailtemplates = [] kw.update({'format':format}) return email()(**kw)
def send_email(self,format='xml',id=''): """ Sends an email, accepts dictionary of info that it will hash into email to send """ if not 'site' in request.environ: return self.nokey() if id != '' and id != None: site = request.environ['site'] email = Email.by_key(site.id,id) if email: c.item = email