equal
deleted
inserted
replaced
62 return func(self, *args, **kwargs) |
62 return func(self, *args, **kwargs) |
63 return wrapper |
63 return wrapper |
64 |
64 |
65 |
65 |
66 class LoginController(Controller): |
66 class LoginController(Controller): |
67 id = 'login' |
67 __regid__ = 'login' |
68 |
68 |
69 def publish(self, rset=None): |
69 def publish(self, rset=None): |
70 """log in the instance""" |
70 """log in the instance""" |
71 if self.config['auth-mode'] == 'http': |
71 if self.config['auth-mode'] == 'http': |
72 # HTTP authentication |
72 # HTTP authentication |
75 # Cookie authentication |
75 # Cookie authentication |
76 return self.appli.need_login_content(self.req) |
76 return self.appli.need_login_content(self.req) |
77 |
77 |
78 |
78 |
79 class LogoutController(Controller): |
79 class LogoutController(Controller): |
80 id = 'logout' |
80 __regid__ = 'logout' |
81 |
81 |
82 def publish(self, rset=None): |
82 def publish(self, rset=None): |
83 """logout from the instance""" |
83 """logout from the instance""" |
84 return self.appli.session_handler.logout(self.req) |
84 return self.appli.session_handler.logout(self.req) |
85 |
85 |
87 class ViewController(Controller): |
87 class ViewController(Controller): |
88 """standard entry point : |
88 """standard entry point : |
89 - build result set |
89 - build result set |
90 - select and call main template |
90 - select and call main template |
91 """ |
91 """ |
92 id = 'view' |
92 __regid__ = 'view' |
93 template = 'main-template' |
93 template = 'main-template' |
94 |
94 |
95 def publish(self, rset=None): |
95 def publish(self, rset=None): |
96 """publish a request, returning an encoded string""" |
96 """publish a request, returning an encoded string""" |
97 view, rset = self._select_view_and_rset(rset) |
97 view, rset = self._select_view_and_rset(rset) |
206 return (False, req._(str(ex).decode('utf-8')), ctrl._edited_entity) |
206 return (False, req._(str(ex).decode('utf-8')), ctrl._edited_entity) |
207 return (False, '???', None) |
207 return (False, '???', None) |
208 |
208 |
209 |
209 |
210 class FormValidatorController(Controller): |
210 class FormValidatorController(Controller): |
211 id = 'validateform' |
211 __regid__ = 'validateform' |
212 |
212 |
213 def response(self, domid, status, args, entity): |
213 def response(self, domid, status, args, entity): |
214 callback = str(self.req.form.get('__onsuccess', 'null')) |
214 callback = str(self.req.form.get('__onsuccess', 'null')) |
215 errback = str(self.req.form.get('__onfailure', 'null')) |
215 errback = str(self.req.form.get('__onfailure', 'null')) |
216 cbargs = str(self.req.form.get('__cbargs', 'null')) |
216 cbargs = str(self.req.form.get('__cbargs', 'null')) |
230 self.req.encoding) |
230 self.req.encoding) |
231 return self.response(domid, status, args, entity) |
231 return self.response(domid, status, args, entity) |
232 |
232 |
233 |
233 |
234 class JSonController(Controller): |
234 class JSonController(Controller): |
235 id = 'json' |
235 __regid__ = 'json' |
236 |
236 |
237 def publish(self, rset=None): |
237 def publish(self, rset=None): |
238 """call js_* methods. Expected form keys: |
238 """call js_* methods. Expected form keys: |
239 |
239 |
240 :fname: the method name without the js_ prefix |
240 :fname: the method name without the js_ prefix |
537 rql = 'SET F %(rel)s T WHERE F eid %(eid_to)s, T eid %(eid_from)s' % {'rel' : rel, 'eid_to' : eid_to, 'eid_from' : eid_from} |
537 rql = 'SET F %(rel)s T WHERE F eid %(eid_to)s, T eid %(eid_from)s' % {'rel' : rel, 'eid_to' : eid_to, 'eid_from' : eid_from} |
538 return eid_from |
538 return eid_from |
539 |
539 |
540 |
540 |
541 class SendMailController(Controller): |
541 class SendMailController(Controller): |
542 id = 'sendmail' |
542 __regid__ = 'sendmail' |
543 __select__ = match_user_groups('managers', 'users') |
543 __select__ = match_user_groups('managers', 'users') |
544 |
544 |
545 def recipients(self): |
545 def recipients(self): |
546 """returns an iterator on email's recipients as entities""" |
546 """returns an iterator on email's recipients as entities""" |
547 eids = self.req.form['recipient'] |
547 eids = self.req.form['recipient'] |
586 url = self.build_url(__message=self.req._('emails successfully sent')) |
586 url = self.build_url(__message=self.req._('emails successfully sent')) |
587 raise Redirect(url) |
587 raise Redirect(url) |
588 |
588 |
589 |
589 |
590 class MailBugReportController(SendMailController): |
590 class MailBugReportController(SendMailController): |
591 id = 'reportbug' |
591 __regid__ = 'reportbug' |
592 __select__ = yes() |
592 __select__ = yes() |
593 |
593 |
594 def publish(self, rset=None): |
594 def publish(self, rset=None): |
595 body = self.req.form['description'] |
595 body = self.req.form['description'] |
596 self.sendmail(self.config['submit-mail'], _('%s error report') % self.config.appid, body) |
596 self.sendmail(self.config['submit-mail'], _('%s error report') % self.config.appid, body) |