def process_request(self, req): if XMailPermissions.checkPermissions(self,req): if ( req.path_info == "/xmail" ): if self._check_init() == False: create_table(self.env) self.log.info("table successfully initialized") #deleting one filter act = None try: if req.args.has_key('xmailAction') and req.args.has_key('action_sel'): action_sel = req.args['action_sel'] act = req.args['xmailAction'] if not act or not action_sel: pass elif act == 'delete': self._deleteFilter(action_sel) elif act == 'activate': self._update_filter(action_sel, 'active', 1) elif act == 'deactivate': self._update_filter(action_sel, 'active', None) except Exception, e: #pass self.log.error( "[process_request] error while executing action %s occured: %s" % (act, e) ) return self.print_main_view(req) elif ( re.match(r'/' + self.MY_PATH + '/xmail-edit.html(?:id.*)?$', req.path_info) ): # edit filter filter = self._getFilterObject(req) id = None save = None try: id = req.args['id'] save = req.args['Save'] except: pass if id and not save: filter.load_filter(self.env.get_db_cnx(), id) return self.print_edit_view(req, filter=filter) elif id and filter.check_filter(): #update existing data try: filter.save(self.env.get_db_cnx(), True, id) return self.print_main_view(req) except Exception, e: self.log.error( "[process_request] error while executing save occured: %s" % (e.args[1]) ) return self.print_edit_view(req, e, filter=filter) elif filter.check_filter(): try: filter.save(self.env.get_db_cnx()) return self.print_main_view(req) except Exception, e: #warning if type(e)==Warning: w = Warning("Illegal value for field 'whereClause'.",e) return self.print_edit_view(req, filter=filter,warning=w) else: e = Exception("Warning occurred until saving Data",e) return self.print_edit_view(req, filter=filter,error=e) except Warning, w: print "warning"
def process_request(self, req): if XMailPermissions.checkPermissions(self, req): if (req.path_info == "/xmail"): if self._check_init() == False: create_table(self.env) self.log.info("table successfully initialized") #deleting one filter act = None try: if req.args.has_key('xmailAction') and req.args.has_key( 'action_sel'): action_sel = req.args['action_sel'] act = req.args['xmailAction'] if not act or not action_sel: pass elif act == 'delete': self._deleteFilter(action_sel) elif act == 'activate': self._update_filter(action_sel, 'active', 1) elif act == 'deactivate': self._update_filter(action_sel, 'active', None) except Exception, e: #pass self.log.error( "[process_request] error while executing action %s occured: %s" % (act, e)) return self.print_main_view(req) elif (re.match(r'/' + self.MY_PATH + '/xmail-edit.html(?:id.*)?$', req.path_info)): # edit filter filter = self._getFilterObject(req) id = None save = None try: id = req.args['id'] save = req.args['Save'] except: pass if id and not save: filter.load_filter(self.env.get_db_cnx(), id) return self.print_edit_view(req, filter=filter) elif id and filter.check_filter(): #update existing data try: filter.save(self.env.get_db_cnx(), True, id) return self.print_main_view(req) except Exception, e: self.log.error( "[process_request] error while executing save occured: %s" % (e.args[1])) return self.print_edit_view(req, e, filter=filter) elif filter.check_filter(): try: filter.save(self.env.get_db_cnx()) return self.print_main_view(req) except Exception, e: #warning if type(e) == Warning: w = Warning( "Illegal value for field 'whereClause'.", e) return self.print_edit_view(req, filter=filter, warning=w) else: e = Exception("Warning occurred until saving Data", e) return self.print_edit_view(req, filter=filter, error=e) except Warning, w: print "warning"
def match_request(self, req): if XMailPermissions.checkPermissions(self, req): return re.match(r'/' + self.MY_PATH + '(?:_trac)?(?:/.*)?$', req.path_info)
def get_navigation_items(self, req): if XMailPermissions.checkPermissions(self, req): yield ('mainnav', self.MY_PATH, tag.a('XMail', href=req.href.xmail()))
def get_active_navigation_item(self, req): if XMailPermissions.checkPermissions(self, req): return self.MY_PATH
def match_request(self, req): if XMailPermissions.checkPermissions(self,req): return re.match(r'/' + self.MY_PATH + '(?:_trac)?(?:/.*)?$', req.path_info)
def get_navigation_items(self, req): if XMailPermissions.checkPermissions(self,req): yield ('mainnav', self.MY_PATH, tag.a('XMail', href=req.href.xmail()))
def get_active_navigation_item(self, req): if XMailPermissions.checkPermissions(self,req): return self.MY_PATH