[SQL-CVS] SQLObject/SQLObject Style.py,1.1,1.2
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-05-05 17:55:51
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject In directory sc8-pr-cvs1:/tmp/cvs-serv12093/SQLObject Modified Files: Style.py Log Message: Style tweak: PPerson -> p_person, not pperson; XXPerson -> xx_person Index: Style.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Style.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Style.py 21 Apr 2003 22:50:32 -0000 1.1 --- Style.py 5 May 2003 17:55:48 -0000 1.2 *************** *** 99,107 **** if s.endswith('ID'): return mixedToUnder(s[:-2] + "_id") ! trans = _mixedToUnderRE.sub(lambda x: '_%s' % x.group(0).lower(), s) if trans.startswith('_'): trans = trans[1:] return trans _underToMixedRE = re.compile('_.') --- 99,113 ---- if s.endswith('ID'): return mixedToUnder(s[:-2] + "_id") ! trans = _mixedToUnderRE.sub(mixedToUnderSub, s) if trans.startswith('_'): trans = trans[1:] return trans + def mixedToUnderSub(match): + m = match.group(0).lower() + if len(m) > 1: + return '_%s_%s' % (m[:-1], m[-1]) + else: + return '_%s' % m _underToMixedRE = re.compile('_.') |