@memoize def _dispatch(event_rh, category_rh): event_view = make_view_func(event_rh) categ_view = make_view_func(category_rh) def view_func(**kwargs): return categ_view( **kwargs) if kwargs['object_type'] == 'category' else event_view( **kwargs) return view_func # Management items = itertools.chain(event_management_object_url_prefixes.items(), [('category', ['/manage'])]) for object_type, prefixes in items: for prefix in prefixes: if object_type == 'category': prefix = '/category/<int:category_id>' + prefix else: prefix = '/event/<int:event_id>' + prefix _bp.add_url_rule(prefix + '/attachments/', 'management', _dispatch(RHManageEventAttachments, RHManageCategoryAttachments), defaults={'object_type': object_type}) _bp.add_url_rule(prefix + '/attachments/info-column', 'management_info_column', RHAttachmentManagementInfoColumn,
_bp.add_url_rule('/import', 'import', cloning.RHImportFromEvent, methods=('GET', 'POST')) _bp.add_url_rule('/import/event-details', 'import_event_details', cloning.RHImportEventDetails, methods=('POST',)) # Posters _bp.add_url_rule('/print-poster/settings', 'poster_settings', posters.RHPosterPrintSettings, methods=('GET', 'POST')) _bp.add_url_rule('/print-poster/<int:template_id>/<uuid>', 'print_poster', posters.RHPrintEventPoster) # Program Codes _bp.add_url_rule('/program-codes/', 'program_codes', program_codes.RHProgramCodes) _bp.add_url_rule('/program-codes/templates', 'program_code_templates', program_codes.RHProgramCodeTemplates, methods=('GET', 'POST')) _bp.add_url_rule('/program-codes/assign/sessions', 'assign_program_codes_sessions', program_codes.RHAssignProgramCodesSessions, methods=('GET', 'POST')) _bp.add_url_rule('/program-codes/assign/session-blocks', 'assign_program_codes_session_blocks', program_codes.RHAssignProgramCodesSessionBlocks, methods=('GET', 'POST')) _bp.add_url_rule('/program-codes/assign/contributions', 'assign_program_codes_contributions', program_codes.RHAssignProgramCodesContributions, methods=('GET', 'POST')) _bp.add_url_rule('/program-codes/assign/subcontributions', 'assign_program_codes_subcontributions', program_codes.RHAssignProgramCodesSubContributions, methods=('GET', 'POST')) for object_type, prefixes in event_management_object_url_prefixes.items(): if object_type == 'subcontribution': continue for prefix in prefixes: prefix = '!/event/<int:event_id>' + prefix _bp.add_url_rule(prefix + '/show-non-inheriting', 'show_non_inheriting', protection.RHShowNonInheriting, defaults={'object_type': object_type}) _compat_bp = IndicoBlueprint('compat_event_management', __name__, url_prefix='/event/<int:event_id>/manage') _compat_bp.add_url_rule('/general/', 'settings', make_compat_redirect_func(_bp, 'settings'))
_bp = IndicoBlueprint('attachments', __name__, template_folder='templates', virtual_template_folder='attachments') @memoize def _dispatch(event_rh, category_rh): event_view = make_view_func(event_rh) categ_view = make_view_func(category_rh) def view_func(**kwargs): return categ_view(**kwargs) if kwargs['object_type'] == 'category' else event_view(**kwargs) return view_func # Management items = itertools.chain(event_management_object_url_prefixes.items(), [('category', ['/manage'])]) for object_type, prefixes in items: for prefix in prefixes: if object_type == 'category': prefix = '/category/<int:category_id>' + prefix else: prefix = '/event/<int:event_id>' + prefix _bp.add_url_rule(prefix + '/attachments/', 'management', _dispatch(RHManageEventAttachments, RHManageCategoryAttachments), defaults={'object_type': object_type}) _bp.add_url_rule(prefix + '/attachments/info-column', 'management_info_column', RHAttachmentManagementInfoColumn, defaults={'object_type': object_type}) _bp.add_url_rule(prefix + '/attachments/add/files', 'upload', _dispatch(RHAddEventAttachmentFiles, RHAddCategoryAttachmentFiles), methods=('GET', 'POST'), defaults={'object_type': object_type})