def load(self, info): getPlugin('worker').load(info) dist = os.path.join(os.path.dirname(__file__), 'dist') webroot = staticFile(os.path.join(dist, 'index.html')) registerPluginWebroot(webroot, 'stroke') info['config']['/stroke_static'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'stroke_static') } info['config']['/itk'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'itk') } info['apiRoot'].study = Study() info['apiRoot'].series = Series() info['apiRoot'].item.route('GET', (':id', 'dicom_thumbnail', ':uid'), _getThumbnail) info['apiRoot'].item.route('POST', (':id', 'dicom_thumbnail'), _createThumbnail) Folder().ensureIndex(('isStudy', {'sparse': True})) Folder().exposeFields(level=AccessType.READ, fields={ 'isStudy', 'nSeries', 'studyDate', 'patientId', 'studyModality' }) Item().exposeFields(level=AccessType.READ, fields={'isSeries'}) events.bind('model.file.finalizeUpload.after', 'stroke', _handleUpload) events.bind('model.item.remove', 'stroke.decrement_series_count', _decrementSeriesCount) events.bind('model.item.remove', 'stroke.clean_thumbnails', lambda e: _removeThumbnails(e.info)) # Guest user support events.bind('model.user.authenticate', 'stroke', _authenticateGuestUser) try: User().createUser(login='******', password='******', firstName='Guest', lastName='User', email='*****@*****.**') except ValidationException: pass
def load(self, info): getPlugin('gravatar').load(info) getPlugin('jobs').load(info) getPlugin('worker').load(info) getPlugin('thumbnails').load(info) mail_utils.addTemplateDirectory(os.path.join(_HERE, 'mail_templates')) ModelImporter.registerModel('challenge', Challenge, 'covalic') ModelImporter.registerModel('phase', Phase, 'covalic') ModelImporter.registerModel('submission', Submission, 'covalic') resource.allowedSearchTypes.add('challenge.covalic') info['apiRoot'].challenge = ChallengeResource() info['apiRoot'].challenge_phase = PhaseResource() info['apiRoot'].covalic_submission = SubmissionResource() webroot = WebrootBase(os.path.join(_HERE, 'webroot.mako')) webroot.updateHtmlVars({ 'pluginCss': [ plugin for plugin in loadedPlugins() if os.path.exists(os.path.join( STATIC_ROOT_DIR, 'built', 'plugins', plugin, 'plugin.min.css')) ], 'pluginJs': [ plugin for plugin in loadedPlugins() if os.path.exists(os.path.join( STATIC_ROOT_DIR, 'built', 'plugins', plugin, 'plugin.min.js')) ] }) registerPluginWebroot(webroot, 'covalic') events.bind('jobs.job.update', 'covalic', onJobUpdate) events.bind('model.setting.validate', 'covalic', validateSettings) events.bind('model.challenge_challenge.save.after', 'covalic', challengeSaved) events.bind('model.challenge_phase.save.after', 'covalic', onPhaseSave) events.bind('model.user.save.after', 'covalic', onUserSave)
def testRegisterWebroot(registry): plugin.registerPluginWebroot('webroot', 'plugin') assert plugin.getPluginWebroots() == {'plugin': 'webroot'}
def load(self, info): registerPluginWebroot(SomeWebroot(), 'has_webroot')
def load(self, info): getPlugin('worker').load(info) addTemplateDirectory(os.path.join(os.path.dirname(__file__)), 'mail_templates') dist = os.path.join(os.path.dirname(__file__), 'dist') webroot = staticFile(os.path.join(dist, 'index.html')) registerPluginWebroot(webroot, 'demo_site') info['config']['/stroke_ct_static'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'stroke_ct_static') } info['config']['/itk'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'itk') } info['apiRoot'].study = Study() info['apiRoot'].series = Series() info['apiRoot'].photomorph = Photomorph() info['apiRoot'].inpainting = Inpainting() Folder().ensureIndex(('isStudy', {'sparse': True})) Folder().ensureIndex(('isPhotomorph', {'sparse': True})) Folder().ensureIndex(('photomorphExampleFolder', {'sparse': True})) Folder().ensureIndex(('inpaintingExampleFolder', {'sparse': True})) Folder().exposeFields(level=AccessType.READ, fields={ 'isStudy', 'nSeries', 'studyDate', 'patientId', 'studyModality', 'photomorphJobId', 'isPhotomorph', 'photomorphInputFolderId', 'photomorphOutputItems', 'photomorphJobStatus', 'photomorphMaskRect' }) Item().exposeFields(level=AccessType.READ, fields={ 'isSeries', 'isPhotomorph', 'originalName', 'photomorphTakenDate' }) Job().exposeFields(level=AccessType.READ, fields={ 'photomorphId', 'inpaintingImageId', 'inpaintingMaskId', 'inpaintingImageResultId', 'inpaintingFolderId' }) events.bind('model.file.finalizeUpload.after', 'demo_site', _handleUpload) events.bind('model.item.remove', 'demo_site', _itemDeleted) events.bind('jobs.job.update', 'demo_site', _jobUpdated) # Guest user support events.bind('model.user.authenticate', 'demo_site', _authenticateGuestUser) try: User().createUser(login='******', password='******', firstName='Guest', lastName='User', email='*****@*****.**') except ValidationException: pass