root/Cheetah/convertTmplPathToModuleName.py
| Revision f17b49bd2a9cb5c693518283252cdbca4d04136b, 496 bytes (checked in by Jason Michalski <armooo@armooo.net>, 2 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | import os.path |
| 2 | import string |
| 3 | |
| 4 | l = ['_'] * 256 |
| 5 | for c in string.digits + string.letters: |
| 6 | l[ord(c)] = c |
| 7 | _pathNameTransChars = string.join(l, '') |
| 8 | del l, c |
| 9 | |
| 10 | def convertTmplPathToModuleName(tmplPath, |
| 11 | _pathNameTransChars=_pathNameTransChars, |
| 12 | splitdrive=os.path.splitdrive, |
| 13 | translate=string.translate, |
| 14 | ): |
| 15 | return translate(splitdrive(tmplPath)[1], _pathNameTransChars) |
Note: See TracBrowser for help on using the browser.
