Package web2py :: Package gluon :: Module myregex
[hide private]
[frames] | no frames]

Source Code for Module web2py.gluon.myregex

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3   
 4  """ 
 5  This file is part of the web2py Web Framework 
 6  Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> 
 7  License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) 
 8  """ 
 9   
10  import re 
11   
12  # pattern to find defined tables 
13   
14  regex_tables = re.compile(\ 
15      """^[\w]+\.define_table\(\s*[\'\"](?P<name>[\w_]+)[\'\"]""", 
16      flags=re.M) 
17   
18  # pattern to find exposed functions in controller 
19   
20  regex_expose = re.compile(\ 
21      '^def\s+(?P<name>(?:[a-zA-Z0-9]\w*)|(?:_[a-zA-Z0-9]\w*))\(\)\s*:', 
22      flags=re.M) 
23   
24  regex_include = re.compile(\ 
25      '(?P<all>\{\{\s*include\s+[\'"](?P<name>[^\'"]*)[\'"]\s*\}\})') 
26   
27  regex_extend = re.compile(\ 
28      '^\s*(?P<all>\{\{\s*extend\s+[\'"](?P<name>[^\'"]+)[\'"]\s*\}\})',re.MULTILINE) 
29