File tree 1 file changed +7
-7
lines changed
python/plugins/fTools/tools
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -165,17 +165,17 @@ def testForUniqueness( fieldList1, fieldList2 ):
165
165
166
166
# Create a unique field name based on input field name
167
167
def createUniqueFieldName ( field ):
168
- check = field .name (). right ( 2 )
169
- shortName = field .name (). left ( 8 )
170
- if check . startsWith ( "_" ) :
171
- ( val , test ) = check . right ( 1 ). toInt ()
172
- if test :
168
+ check = field .name ()[ - 2 :]
169
+ shortName = field .name ()[: 8 ]
170
+ if check [ 0 ] == "_" :
171
+ try :
172
+ val = int ( check [ - 1 :] )
173
173
if val < 2 :
174
174
val = 2
175
175
else :
176
176
val = val + 1
177
- field .setName ( shortName . left ( len ( shortName )- 1 ) + unicode ( val ) )
178
- else :
177
+ field .setName ( shortName [ len ( shortName )- 1 :] + unicode ( val ) )
178
+ except exceptions . ValueError :
179
179
field .setName ( shortName + "_2" )
180
180
else :
181
181
field .setName ( shortName + "_2" )
You can’t perform that action at this time.
0 commit comments