raw regexp strings

This commit is contained in:
j 2024-09-02 13:36:55 +02:00
parent a218b906cc
commit caae7d84bc
7 changed files with 8 additions and 8 deletions

View file

@ -246,7 +246,7 @@ def addCollection(request, data):
'type' and 'view'.
see: editCollection, findCollections, getCollection, removeCollection, sortCollections
'''
data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
name = data['name']
if not name:
name = "Untitled"

View file

@ -262,7 +262,7 @@ def addEdit(request, data):
}
see: editEdit, findEdit, getEdit, removeEdit, sortEdits
'''
data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
name = data['name']
if not name:
name = "Untitled"

View file

@ -61,7 +61,7 @@ def sort_title(title):
title = sort_string(title)
#title
title = re.sub('[\'!¿¡,\.;\-"\:\*\[\]]', '', title)
title = re.sub(r'[\'!¿¡,\.;\-"\:\*\[\]]', '', title)
return title.strip()
def get_positions(ids, pos, decode_id=False):

View file

@ -242,7 +242,7 @@ def addList(request, data):
'type' and 'view'.
see: editList, findLists, getList, removeList, sortLists
'''
data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
name = data['name']
if not name:
name = "Untitled"

View file

@ -39,7 +39,7 @@ def addText(request, data):
}
see: editText, findTexts, getText, removeText, sortTexts
'''
data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip()
name = data['name']
if not name:
name = "Untitled"

View file

@ -64,7 +64,7 @@ def padma_video(request, url):
except:
return app.views.index(request)
if view:
timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view)
timecodes = re.compile(r'(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view)
if timecodes:
view = ','.join(timecodes[0])
if view:

View file

@ -914,7 +914,7 @@ def addGroup(request, data):
created = False
n = 1
name = data['name']
_name = re.sub(' \[\d+\]$', '', name).strip()
_name = re.sub(r' \[\d+\]$', '', name).strip()
while not created:
g, created = Group.objects.get_or_create(name=name)
n += 1
@ -946,7 +946,7 @@ def editGroup(request, data):
name = data['name']
n = 1
name = data['name']
_name = re.sub(' \[\d+\]$', '', name).strip()
_name = re.sub(r' \[\d+\]$', '', name).strip()
while Group.objects.filter(name=name).count():
n += 1
name = '%s [%d]' % (_name, n)