def process_context(self, request, msg): """ Process and return the context. """ try: self.template = self.load_view_template() if (self.template): try: self.datasetrecords = self.get_datarecords() self.available_rules = self.load_all_rules() self.paginated_rules = Paginator(self.available_rules, 8) self.next_page = request.GET.get("page") try: self.rule_page = self.paginated_rules.page( self.next_page) except PageNotAnInteger: self.rule_page = self.paginated_rules.page(1) except EmptyPage: self.rule_page = self.paginated_rules.page( self.paginated_rules.num_pages) #print "PAGE ", self.rule_page self.model_headers = userview.parse_model_fields( legacymodel.ReplicationDatabase) self.returned = self.excludes(self.model_headers, "destinationpassword") self.context = RequestContext( request, { "basetitle": mytitle, "datasetrecords": self.datasetrecords, "srules": self.rule_page, "rule_headers": self.returned, "msg": msg }) return self.template.render(self.context) except: raise else: return False except: raise
def process_context_success(self, request, msg): """ Process and return the context. """ try: self.template = loader.get_template("viewrules.html") if (self.template): try: self.datasetrecords = self.get_datarecords() self.available_rules = self.load_all_rules() self.paginated_rules = Paginator(self.available_rules, 8) self.next_page = request.GET.get("page") try: self.rule_page = self.paginated_rules.page( self.next_page) except PageNotAnInteger: self.rule_page = self.paginated_rules.page(1) except EmptyPage: self.rule_page = self.paginated_rules.page( self.paginated_rules.num_pages) #print "PAGE ", self.rule_page self.model_headers = userview.parse_model_fields( securitymodels.SecurityRules) self.context = RequestContext( request, { "basetitle": mytitle, "datasetrecords": self.datasetrecords, "srules": self.rule_page, "rule_headers": self.model_headers, "msg": msg }) return self.template.render(self.context) except: raise else: return False except: raise