本文整理汇总了Python中indico.modules.events.notes.models.notes.EventNote.get_for_linked_object方法的典型用法代码示例。如果您正苦于以下问题:Python EventNote.get_for_linked_object方法的具体用法?Python EventNote.get_for_linked_object怎么用?Python EventNote.get_for_linked_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.events.notes.models.notes.EventNote
的用法示例。
在下文中一共展示了EventNote.get_for_linked_object方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getParams
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def _getParams(self):
super(NoteExportHook, self)._getParams()
event = self._obj = Event.get(self._pathParams['event_id'], is_deleted=False)
if event is None:
raise HTTPAPIError('No such event', 404)
session_id = self._pathParams.get('session_id')
if session_id:
self._obj = Session.query.with_parent(event).filter_by(id=session_id).first()
if self._obj is None:
raise HTTPAPIError("No such session", 404)
contribution_id = self._pathParams.get('contribution_id')
if contribution_id:
contribution = self._obj = (Contribution.query.with_parent(event)
.filter_by(id=contribution_id, is_deleted=False)
.first())
if contribution is None:
raise HTTPAPIError("No such contribution", 404)
subcontribution_id = self._pathParams.get('subcontribution_id')
if subcontribution_id:
self._obj = SubContribution.query.with_parent(contribution).filter_by(id=subcontribution_id,
is_deleted=False).first()
if self._obj is None:
raise HTTPAPIError("No such subcontribution", 404)
self._note = EventNote.get_for_linked_object(self._obj, preload_event=False)
if self._note is None or self._note.is_deleted:
raise HTTPAPIError("No such note", 404)
示例2: _process
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def _process(self):
note = EventNote.get_for_linked_object(self.object, preload_event=False)
if note is not None:
note.delete(session.user)
signals.event.notes.note_deleted.send(note)
logger.info('Note %s deleted by %s', note, session.user)
self.event.log(EventLogRealm.participants, EventLogKind.negative, 'Minutes', 'Removed minutes',
session.user, data=note.link_event_log_data)
return redirect(self.event.url)
示例3: _process
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def _process(self):
note = EventNote.get_for_linked_object(self.object, preload_event=False)
if note is not None:
note.delete(session.user)
signals.event.notes.note_deleted.send(note)
logger.info('Note {} deleted by {}'.format(note, session.user))
self.event.log(EventLogRealm.participants, EventLogKind.negative, 'Minutes',
'Removed minutes from {} {}'.format(self.object_type, self.object.getTitle()), session.user)
return redirect(url_for('event.conferenceDisplay', self.event))
示例4: _process
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def _process(self):
note = EventNote.get_for_linked_object(self.object, preload_event=False)
if note is not None:
note.delete(session.user)
signals.event.notes.note_deleted.send(note)
logger.info("Note {} deleted by {}".format(note, session.user))
self.event.log(
EventLogRealm.participants,
EventLogKind.negative,
"Minutes",
"Removed minutes",
session.user,
data=note.link_event_log_data,
)
return redirect(url_for("event.conferenceDisplay", self.event))
示例5: _getParams
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def _getParams(self):
super(NoteExportHook, self)._getParams()
event = self._obj = ConferenceHolder().getById(self._pathParams['event_id'], True)
if event is None:
raise HTTPAPIError('No such event', 404)
session_id = self._pathParams.get('session_id')
if session_id:
session = self._obj = event.getSessionById(session_id)
if session is None:
raise HTTPAPIError("No such session", 404)
contribution_id = self._pathParams.get('contribution_id')
if contribution_id:
contribution = self._obj = session.getContributionById(contribution_id)
if contribution is None:
raise HTTPAPIError("No such contribution", 404)
subcontribution_id = self._pathParams.get('subcontribution_id')
if subcontribution_id:
subcontribution = self._obj = contribution.getSubContributionById(subcontribution_id)
if subcontribution is None:
raise HTTPAPIError("No such subcontribution", 404)
self._note = EventNote.get_for_linked_object(self._obj)
if self._note is None or self._note.is_deleted:
raise HTTPAPIError("No such note", 404)
示例6: _make_form
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def _make_form(self, source=None):
note = None
if not source:
note = EventNote.get_for_linked_object(self.object, preload_event=False)
return NoteForm(obj=self._get_defaults(note=note, source=source))
示例7: test_get_for_linked_object_deleted
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def test_get_for_linked_object_deleted(note, dummy_user):
note.create_revision(RenderMode.html, 'test', dummy_user)
note.is_deleted = True
assert EventNote.get_for_linked_object(note.linked_object) is None
示例8: test_get_for_linked_object_preload
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def test_get_for_linked_object_preload(note, dummy_user, mocker, preload):
note.create_revision(RenderMode.html, 'test', dummy_user)
assert EventNote.get_for_linked_object(note.linked_object, preload_event=preload)
query = mocker.patch.object(EventNote, 'query', new=PropertyMock())
EventNote.get_for_linked_object(note.linked_object)
assert query.called == (not preload)
示例9: test_get_for_linked_object
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def test_get_for_linked_object(note, dummy_user, create_event):
note.create_revision(RenderMode.html, 'test', dummy_user)
assert EventNote.get_for_linked_object(note.linked_object) == note
assert EventNote.get_for_linked_object(create_event('123')) is None
示例10: test_get_for_linked_object_preload
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def test_get_for_linked_object_preload(note, dummy_user, count_queries, preload):
note.create_revision(RenderMode.html, 'test', dummy_user)
assert EventNote.get_for_linked_object(note.object, preload_event=preload)
with count_queries() as cnt:
EventNote.get_for_linked_object(note.object)
assert (cnt() == 0) == preload
示例11: has_note
# 需要导入模块: from indico.modules.events.notes.models.notes import EventNote [as 别名]
# 或者: from indico.modules.events.notes.models.notes.EventNote import get_for_linked_object [as 别名]
def has_note(self):
return EventNote.get_for_linked_object(self, preload_event=self.PRELOAD_EVENT_NOTES) is not None