comparison roundup/cgi/templating.py @ 7030:bb3845cf6b8e

flake8 E225 missing whitespace around operator
author John Rouillard <rouilj@ieee.org>
date Sun, 09 Oct 2022 17:58:53 -0400
parents 0409659241c5
children 0c99d1d0254a
comparison
equal deleted inserted replaced
7029:0409659241c5 7030:bb3845cf6b8e
213 Then it stores the nonce, the session id for the user 213 Then it stores the nonce, the session id for the user
214 and the user id in the one time key database for use 214 and the user id in the one time key database for use
215 by the csrf validator that runs in the client::inner_main 215 by the csrf validator that runs in the client::inner_main
216 module/function. 216 module/function.
217 ''' 217 '''
218 otks=client.db.getOTKManager() 218 otks = client.db.getOTKManager()
219 key = otks.getUniqueKey() 219 key = otks.getUniqueKey()
220 # lifetime is in minutes. 220 # lifetime is in minutes.
221 if lifetime is None: 221 if lifetime is None:
222 lifetime = client.db.config['WEB_CSRF_TOKEN_LIFETIME'] 222 lifetime = client.db.config['WEB_CSRF_TOKEN_LIFETIME']
223 223
621 html_version = 'html4' 621 html_version = 'html4'
622 if hasattr(self._client.instance.config, 'HTML_VERSION'): 622 if hasattr(self._client.instance.config, 'HTML_VERSION'):
623 html_version = self._client.instance.config.HTML_VERSION 623 html_version = self._client.instance.config.HTML_VERSION
624 if html_version == 'xhtml': 624 if html_version == 'xhtml':
625 self.input = input_xhtml 625 self.input = input_xhtml
626 self.cgi_escape_attrs=xhtml_cgi_escape_attrs 626 self.cgi_escape_attrs = xhtml_cgi_escape_attrs
627 else: 627 else:
628 self.input = input_html4 628 self.input = input_html4
629 self.cgi_escape_attrs=html4_cgi_escape_attrs 629 self.cgi_escape_attrs = html4_cgi_escape_attrs
630 # self._context is used for translations. 630 # self._context is used for translations.
631 # will be initialized by the first call to .gettext() 631 # will be initialized by the first call to .gettext()
632 self._context = None 632 self._context = None
633 633
634 def gettext(self, msgid): 634 def gettext(self, msgid):
771 To return all properties call it with cansearch=False 771 To return all properties call it with cansearch=False
772 and it will return properties the user is unable to 772 and it will return properties the user is unable to
773 search. 773 search.
774 """ 774 """
775 l = [] 775 l = []
776 canSearch=self._db.security.hasSearchPermission 776 canSearch = self._db.security.hasSearchPermission
777 userid=self._client.userid 777 userid = self._client.userid
778 for name, prop in self._props.items(): 778 for name, prop in self._props.items():
779 if cansearch and \ 779 if cansearch and \
780 not canSearch(userid, self._classname, name): 780 not canSearch(userid, self._classname, name):
781 continue 781 continue
782 for klass, htmlklass in propclasses: 782 for klass, htmlklass in propclasses:
919 if property: 919 if property:
920 property = '&amp;property=%s'%property 920 property = '&amp;property=%s'%property
921 if form: 921 if form:
922 form = '&amp;form=%s'%form 922 form = '&amp;form=%s'%form
923 if inputtype: 923 if inputtype:
924 type= '&amp;type=%s'%inputtype 924 type = '&amp;type=%s'%inputtype
925 if filter: 925 if filter:
926 filterprops = filter.split(';') 926 filterprops = filter.split(';')
927 filtervalues = [] 927 filtervalues = []
928 names = [] 928 names = []
929 for x in filterprops: 929 for x in filterprops:
1686 item = match.group('item') 1686 item = match.group('item')
1687 cls = match.group('class').lower() 1687 cls = match.group('class').lower()
1688 id = match.group('id') 1688 id = match.group('id')
1689 fragment = match.group('fragment') 1689 fragment = match.group('fragment')
1690 if fragment is None: 1690 if fragment is None:
1691 fragment="" 1691 fragment = ""
1692 try: 1692 try:
1693 # make sure cls is a valid tracker classname 1693 # make sure cls is a valid tracker classname
1694 cl = self._db.getclass(cls) 1694 cl = self._db.getclass(cls)
1695 if not cl.hasnode(id): 1695 if not cl.hasnode(id):
1696 return item 1696 return item
2117 checked = value and "checked" or "" 2117 checked = value and "checked" or ""
2118 if value: 2118 if value:
2119 y_rb = self.input(type="radio", name=self._formname, value="yes", 2119 y_rb = self.input(type="radio", name=self._formname, value="yes",
2120 checked="checked", id="%s_%s"%(self._formname, 'yes'), **kwargs) 2120 checked="checked", id="%s_%s"%(self._formname, 'yes'), **kwargs)
2121 2121
2122 n_rb =self.input(type="radio", name=self._formname, value="no", 2122 n_rb = self.input(type="radio", name=self._formname, value="no",
2123 id="%s_%s"%(self._formname, 'no'), **kwargs) 2123 id="%s_%s"%(self._formname, 'no'), **kwargs)
2124 else: 2124 else:
2125 y_rb = self.input(type="radio", name=self._formname, value="yes", 2125 y_rb = self.input(type="radio", name=self._formname, value="yes",
2126 id="%s_%s"%(self._formname, 'yes'), **kwargs) 2126 id="%s_%s"%(self._formname, 'yes'), **kwargs)
2127 2127
2134 u_rb = self.input(type="radio", name=self._formname, value="", 2134 u_rb = self.input(type="radio", name=self._formname, value="",
2135 id="%s_%s"%(self._formname, 'unk'), **kwargs) 2135 id="%s_%s"%(self._formname, 'unk'), **kwargs)
2136 else: 2136 else:
2137 # don't generate a trivalue radiobutton. 2137 # don't generate a trivalue radiobutton.
2138 u_label = '' 2138 u_label = ''
2139 u_rb='' 2139 u_rb = ''
2140 2140
2141 if (labelfirst): 2141 if (labelfirst):
2142 s = u_label + u_rb + y_label + y_rb + n_label + n_rb 2142 s = u_label + u_rb + y_label + y_rb + n_label + n_rb
2143 else: 2143 else:
2144 s = u_label + u_rb +y_rb + y_label + n_rb + n_label 2144 s = u_label + u_rb + y_rb + y_label + n_rb + n_label
2145 2145
2146 return s 2146 return s
2147 2147
2148 2148
2149 class DateHTMLProperty(HTMLProperty): 2149 class DateHTMLProperty(HTMLProperty):
2576 continue 2576 continue
2577 2577
2578 # figure if this option is selected 2578 # figure if this option is selected
2579 s = '' 2579 s = ''
2580 # record the marker for the selected item if requested 2580 # record the marker for the selected item if requested
2581 selected_mark='' 2581 selected_mark = ''
2582 2582
2583 if value in [optionid, option]: 2583 if value in [optionid, option]:
2584 s = 'selected="selected" ' 2584 s = 'selected="selected" '
2585 if (showdef): 2585 if (showdef):
2586 selected_mark = showdef 2586 selected_mark = showdef
2766 2766
2767 if 'value' not in kwargs: 2767 if 'value' not in kwargs:
2768 value = self._value[:] 2768 value = self._value[:]
2769 # map the id to the label property 2769 # map the id to the label property
2770 if not linkcl.getkey(): 2770 if not linkcl.getkey():
2771 showid=1 2771 showid = 1
2772 if not showid: 2772 if not showid:
2773 k = linkcl.labelprop(1) 2773 k = linkcl.labelprop(1)
2774 value = lookupKeys(linkcl, k, value) 2774 value = lookupKeys(linkcl, k, value)
2775 value = ','.join(value) 2775 value = ','.join(value)
2776 kwargs["value"] = value 2776 kwargs["value"] = value

Roundup Issue Tracker: http://roundup-tracker.org/