Skip to content

Commit 0ef66ae

Browse files
committed
Added optional arguments title and user to create_recording(), to make it possible to affect those attributes.
- Legacy-Id: 14966
1 parent e33afad commit 0ef66ae

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

ietf/secr/proceedings/proc_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,19 @@ def get_or_create_recording_document(url,session):
177177
except ObjectDoesNotExist:
178178
return create_recording(session,url)
179179

180-
def create_recording(session,url):
180+
def create_recording(session, url, title=None, user=None):
181181
'''
182182
Creates the Document type=recording, setting external_url and creating
183183
NewRevisionDocEvent
184184
'''
185185
sequence = get_next_sequence(session.group,session.meeting,'recording')
186186
name = 'recording-{}-{}-{}'.format(session.meeting.number,session.group.acronym,sequence)
187187
time = session.official_timeslotassignment().timeslot.time.strftime('%Y-%m-%d %H:%M')
188-
if url.endswith('mp3'):
189-
title = 'Audio recording for {}'.format(time)
190-
else:
191-
title = 'Video recording for {}'.format(time)
188+
if not title:
189+
if url.endswith('mp3'):
190+
title = 'Audio recording for {}'.format(time)
191+
else:
192+
title = 'Video recording for {}'.format(time)
192193

193194
doc = Document.objects.create(name=name,
194195
title=title,
@@ -202,7 +203,7 @@ def create_recording(session,url):
202203

203204
# create DocEvent
204205
NewRevisionDocEvent.objects.create(type='new_revision',
205-
by=Person.objects.get(name='(System)'),
206+
by=user or Person.objects.get(name='(System)'),
206207
doc=doc,
207208
rev=doc.rev,
208209
desc='New revision available',

0 commit comments

Comments
 (0)