From 3a9c8d9c0f9d2722e533d58c2307148acfc35065 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Tue, 4 Sep 2012 14:43:38 -0500 Subject: [PATCH] fixed update with compute fields (again) and ecomponents in markmin --- Makefile | 4 +-- VERSION | 2 +- gluon/contrib/markmin/markmin2html.py | 35 +++++++++++++++------------ gluon/sqlhtml.py | 4 +-- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 6329b95a..027027d3 100644 --- a/Makefile +++ b/Makefile @@ -34,9 +34,9 @@ src: make clean ### clean up baisc apps rm -f routes.py - rm -f applications/*/sessions/* + rm -f applications/*/sessions/* rm -f applications/*/errors/* | echo 'too many files' - rm -f applications/*/cache/* + rm -f applications/*/cache/* rm -f applications/admin/databases/* rm -f applications/welcome/databases/* rm -f applications/examples/databases/* diff --git a/VERSION b/VERSION index 06f72325..c1f458ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.6 (2012-09-03 16:15:01) stable +Version 2.0.6 (2012-09-04 14:43:30) stable diff --git a/gluon/contrib/markmin/markmin2html.py b/gluon/contrib/markmin/markmin2html.py index e1f365c0..c74dcfea 100755 --- a/gluon/contrib/markmin/markmin2html.py +++ b/gluon/contrib/markmin/markmin2html.py @@ -544,6 +544,7 @@ regex_list=re.compile('^(?:(?:(#{1,6})|(?:(\.+|\++|\-+)(\.)?))\s+)?(.*)$') regex_bq_headline=re.compile('^(?:(\.+|\++|\-+)(\.)?\s+)?(-{3}-*)$') regex_tq=re.compile('^(-{3}-*)(?::(?P[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P

[a-zA-Z][_a-zA-Z\-\d]*)\])?)?$') regex_proto = re.compile(r'(?/=])(?P

\w+):(?P\w+://[\w\d\-+=?%&/:.]+)', re.M) +regex_auto = re.compile(r'(?/=])(?P\w+://[^\s\'\"\]\}\)]+)',re.M) regex_auto = re.compile(r'(?/=])(?P\w+://[\w\d\-+_=?%&/:.]+)',re.M) regex_link=re.compile(r'('+LINK+r')|\[\[(?P.+?)\]\]') regex_link_level2=re.compile(r'^(?P\S.*?)?(?:\s+\[(?P.+?)\])?(?:\s+(?P\S+))?(?:\s+(?P

popup))?\s*$') @@ -620,7 +621,7 @@ def render(text, - class_prefix is a prefix for ALL classes in markmin text. E.g. if class_prefix='my_' then for ``test``:cls class will be changed to "my_cls" (default value is '') - id_prefix is prefix for ALL ids in markmin text (default value is 'markmin_'). E.g.: - -- [[id]] will be converted to + -- [[id]] will be converted to

-- [[link #id]] will be converted to link -- ``test``:cls[id] will be converted to test @@ -832,22 +833,11 @@ def render(text, # this is experimental @{function/args} # turns into a digitally signed URL def u1(match,URL=URL): - a,c,f,args = match.group('a','c','f','args') + a,c,f,args = match.group('a','c','f','args') return URL(a=a or None,c=c or None,f = f or None, args=args.split('/'), scheme=True, host=True) text = regex_URL.sub(u1,text) - if environment: - def u2(match, environment=environment): - f = environment.get(match.group('a'), match.group(0)) - if callable(f): - try: - f = f(match.group('b')) - except Exception, e: - f = 'ERROR: %s' % e - return str(f) - text = regex_env.sub(u2, text) - if latex == 'google': text = regex_dd.sub('``\g``:latex ', text) @@ -1314,12 +1304,24 @@ def render(text, return '%s' % (cls, id, escape(code[beg:end])) text = regex_expand_meta.sub(expand_meta, text) text = text.translate(ttab_out) + + if environment: + def u2(match, environment=environment): + f = environment.get(match.group('a'), match.group(0)) + if callable(f): + try: + f = f(match.group('b')) + except Exception, e: + f = 'ERROR: %s' % e + return str(f) + text = regex_env.sub(u2, text) + return text -def markmin2html(text, extra={}, allowed={}, sep='p', +def markmin2html(text, extra={}, allowed={}, sep='p', autolinks='default', protolinks='default', - class_prefix='', id_prefix='markmin_', pretty_print=False): - return render(text, extra, allowed, sep, + class_prefix='', id_prefix='markmin_', pretty_print=False): + return render(text, extra, allowed, sep, autolinks=autolinks, protolinks=protolinks, class_prefix=class_prefix, id_prefix=id_prefix, pretty_print=pretty_print) @@ -1403,3 +1405,4 @@ if __name__ == '__main__': print " file.markmin [file.css] - process file.markmin + built in file.css (optional)" print " file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)" run_doctests() + diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index be9ba86e..ffa05bf5 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -1376,8 +1376,8 @@ class SQLFORM(FORM): # this should never happen but seems to happen to some del fields['delete_this_record'] for field in self.table: - if not field.name in fields and field.writable==False \ - and field.update is None: + if not field.name in fields and field.writable is False \ + and field.update is None and field.compute is None: if record_id and self.record: fields[field.name] = self.record[field.name] elif not self.table[field.name].default is None: