def cli_params(interval, requestrate, destination): """CLI for basic configuration parameters for rate limit plugins""" # generate ADR file with passed values md = Markdowner('rate_limit_adr_0001') rate_limit_configuration = { 'interval': interval, 'requestrate': requestrate, 'destination': destination } md.generate_ADR( 'Rate Limit', 'None', 'Context for rate limiting pattern', 'Prosa about the decision in the ADD', 'Consequences for this rate', rate_limit_configuration ) rate_limit_config = md.grab_config_set() # pass configuration to parser component if provider == 'kong': self.parsing_kong(config_file, int(rate_limit_config['interval']) , int(rate_limit_config['requestrate']), rate_limit_config['destination']) elif provider == 'istio': self.parsing_istio(config_file, int(rate_limit_config['interval']) , int(rate_limit_config['requestrate']), rate_limit_config['destination'])
def toggle_markdown(editor): editor.saveNow() current_field = editor.currentField html_field = editor.note.fields[current_field] if not html_field: html_field = u"" markdowner = Markdowner(editor, editor.parentWindow, editor.note, html_field, current_field, preferences) markdowner.start() editor.web.setFocus() editor.web.eval("focusField(%d);" % editor.currentField)
def toggleMarkdown(self): self.saveNow() current_field = self.currentField html_field = self.note.fields[current_field] if not html_field: html_field = u"" markdowner = Markdowner(self, self.parentWindow, self.note, html_field, current_field) markdowner.start() # self.saveNow() self.web.setFocus() self.web.eval("focusField(%d);" % self.currentField)
def toggleMarkdown(self): utility.start_safe_block(const.MARKDOWN_PREFS) self.saveNow() selected = self.web.selectedHtml() current_field = self.currentField html_field = self.note.fields[self.currentField] # if not isinstance(html_field, unicode): # html_field = unicode(html_field) # if not isinstance(selected, unicode): # selected = unicode(selected) if not html_field: html_field = u"" if not selected: selected = u"" markdowner = Markdowner(self, self.parentWindow, self.note, html_field, current_field, selected) markdowner.apply_markdown() self.saveNow() self.web.setFocus() self.web.eval("focusField(%d);" % self.currentField) utility.end_safe_block(const.MARKDOWN_PREFS)
def on_focus_gained(self, note, field): tags = note.tags if not preferences.PREFS.get(const.MARKDOWN_OVERRIDE_EDITING): if const.MARKDOWN_PREFS.get("disable_buttons"): # disable all buttons except for the Markdown toggle self.disableButtons() markdown_button = self._buttons.get(const.MARKDOWN) if markdown_button: # markdown_button.setChecked(True) markdown_button.setEnabled(True) if const.MARKDOWN_PREFS.get("safe_block"): return else: utility.start_safe_block(const.MARKDOWN_PREFS) try: time.sleep(0.001) self.saveNow() except AttributeError as e: print e # TODO: log error html_field = note.fields[field] # if not isinstance(html_field, unicode): # html_field = unicode(html_field) if not html_field: html_field = u"" markdowner = Markdowner(self, self.parentWindow, note, html_field, field, u"") markdowner.on_focus_gained() self.web.setFocus() self.web.eval("focusField(%d);" % self.currentField) note.tags = tags try: time.sleep(0.001) self.updateTags() except AttributeError as e: print e # TODO: log error utility.end_safe_block(const.MARKDOWN_PREFS)