Mercurial > hg > ZDBInterface
comparison DBInterface.py @ 4:0ade331198de
first version of ZDBInlineSearch
| author | casties |
|---|---|
| date | Tue, 15 Feb 2011 19:59:07 +0100 |
| parents | d70e57193731 |
| children | 1b25a85a2165 |
comparison
equal
deleted
inserted
replaced
| 3:d70e57193731 | 4:0ade331198de |
|---|---|
| 51 for node in nodelist: | 51 for node in nodelist: |
| 52 if node.nodeType == node.TEXT_NODE: | 52 if node.nodeType == node.TEXT_NODE: |
| 53 rc = rc + node.data | 53 rc = rc + node.data |
| 54 return rc | 54 return rc |
| 55 | 55 |
| 56 def sqlName(s,lc=True): | 56 def sqlName(s, lc=True, more=''): |
| 57 """returns restricted ASCII-only version of string""" | 57 """returns restricted ASCII-only version of string""" |
| 58 if s is None: | 58 if s is None: |
| 59 return "" | 59 return "" |
| 60 | 60 |
| 61 # all else -> "_" | 61 # all else -> "_" |
| 62 s = re.sub(r'[^A-Za-z0-9_]','_',s) | 62 s = re.sub('[^A-Za-z0-9_'+more+']','_',s) |
| 63 if lc: | 63 if lc: |
| 64 return s.lower() | 64 return s.lower() |
| 65 | 65 |
| 66 return s | 66 return s |
| 67 | 67 |
