当前位置: 首页>>代码示例>>Python>>正文


Python EventNote.get_for_linked_object方法代码示例

本文整理汇总了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)
开发者ID:DirkHoffmann,项目名称:indico,代码行数:28,代码来源:api.py

示例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)
开发者ID:bkolobara,项目名称:indico,代码行数:11,代码来源:controllers.py

示例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))
开发者ID:maaceroo,项目名称:indico,代码行数:11,代码来源:controllers.py

示例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))
开发者ID:mdoucet,项目名称:indico,代码行数:17,代码来源:controllers.py

示例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)
开发者ID:maaceroo,项目名称:indico,代码行数:25,代码来源:api.py

示例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))
开发者ID:bkolobara,项目名称:indico,代码行数:7,代码来源:controllers.py

示例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
开发者ID:maaceroo,项目名称:indico,代码行数:6,代码来源:notes_test.py

示例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)
开发者ID:maaceroo,项目名称:indico,代码行数:8,代码来源:notes_test.py

示例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
开发者ID:maaceroo,项目名称:indico,代码行数:6,代码来源:notes_test.py

示例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
开发者ID:indico,项目名称:indico,代码行数:8,代码来源:notes_test.py

示例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
开发者ID:bkolobara,项目名称:indico,代码行数:4,代码来源:notes.py


注:本文中的indico.modules.events.notes.models.notes.EventNote.get_for_linked_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。