6767def _import_markdown2 ():
6868 try :
6969 import markdown2 , re
70+
7071 class Markdown (markdown2 .Markdown ):
7172 # don't allow disabled protocols in links
7273 _safe_protocols = re .compile ('(?!' + ':|' .join ([re .escape (s ) for s in _disable_url_schemes ]) + ':)' , re .IGNORECASE )
@@ -178,7 +179,7 @@ def link(self, link, title, content):
178179 'content' : escape (content ),
179180 'href' : escape_link (link ),
180181 'rel' : self .rel_value ,
181- 'title' : escape (title ) if title else '' ,
182+ 'title' : escape (title ) if title else '' ,
182183 }
183184
184185 if title :
@@ -199,6 +200,7 @@ def _options(config):
199200
200201 return markdown
201202
203+
202204markdown = _import_markdown2 () or _import_markdown () or _import_mistune ()
203205
204206# bring in the templating support
@@ -338,7 +340,7 @@ def check(self, name):
338340 if l .check (name ):
339341 return True
340342
341- def load (self , name ):
343+ def load (self , name ):
342344 for l in self .loaders :
343345 if l .check (name ):
344346 return l .load (name )
@@ -507,6 +509,7 @@ def classes(self):
507509 m .append (HTMLClass (self ._client , item ))
508510 return m
509511
512+
510513num_re = re .compile (r'^-?\d+$' )
511514
512515
@@ -581,7 +584,7 @@ def html4_cgi_escape_attrs(**attrs):
581584 value is None
582585 Code can use None to indicate a pure boolean.
583586 '''
584- return ' ' .join (['%s="%s"' % (k ,html_escape (str (v ), True ))
587+ return ' ' .join (['%s="%s"' % (k ,html_escape (str (v ), True ))
585588 if v != None else '%s' % (k )
586589 for k ,v in sorted (attrs .items ())])
587590
@@ -2666,7 +2669,7 @@ def reverse(self):
26662669 return self .viewableGenerator (l )
26672670
26682671 def sorted (self , property , reverse = False , NoneFirst = False ):
2669- """ Return this multilink sorted by the given property
2672+ """ Return this multilink sorted by the given property
26702673
26712674 Set Nonefirst to True to sort None/unset property
26722675 before a property with a valid value.
@@ -2689,7 +2692,7 @@ def sorted(self, property, reverse=False, NoneFirst=False):
26892692 if type (prop ) in [hyperdb .Link , hyperdb .Multilink ]:
26902693 orderprop = value [0 ]._db .getclass (prop .classname ).orderprop ()
26912694 sort_by_link = True
2692- else :
2695+ else :
26932696 orderprop = property
26942697 sort_by_link = False
26952698
@@ -2924,6 +2927,7 @@ def make_key_function(db, classname, sort_on=None):
29242927 linkcl = db .getclass (classname )
29252928 if sort_on is None :
29262929 sort_on = linkcl .orderprop ()
2930+
29272931 def keyfunc (a ):
29282932 if num_re .match (a ):
29292933 a = linkcl .get (a , sort_on )
@@ -3220,6 +3224,7 @@ def indexargs_form(self, columns=1, sort=1, group=1, filter=1,
32203224 """
32213225 l = []
32223226 sc = self .special_char
3227+
32233228 def add (k , v ):
32243229 l .append (self .input (type = "hidden" , name = k , value = v ))
32253230 if columns and self .columns :
0 commit comments