| | 73 | |
| | 74 | # CODE COPIED FROM TRAC PROJECT |
| | 75 | # http://trac.edgewall.org/browser/trunk/trac/wiki/api.py?rev=4760#L290 |
| | 76 | # trac:source/trunk/trac/wiki/api.py?rev=4760#L290 |
| | 77 | def check_unicode_camelcase(pagename): |
| | 78 | if not pagename[0].isupper(): |
| | 79 | return False |
| | 80 | pagename = pagename.split('@', 1)[0].split('#', 1)[0] |
| | 81 | if not pagename[-1].islower(): |
| | 82 | return False |
| | 83 | humps = 0 |
| | 84 | for a, b in pairwise(pagename): |
| | 85 | if a.isupper(): |
| | 86 | if b.islower(): |
| | 87 | humps += 1 |
| | 88 | else: |
| | 89 | return False |
| | 90 | return humps > 1 |
| | 91 | # END CODE COPIED FROM TRAC PROJECT |
| | 92 | |
| | 93 | #TODO: import the above function instead of duplicating code here |
| | 94 | # currently not possible, as the function is a nested one |
| | 95 | #from trac.wiki.api import check_unicode_camelcase |
| | 96 | from trac.util import pairwise |
| | 97 | |