from django.http import HttpResponse from django.conf.urls.defaults import * from web.auth import secured_url as secured def component_graphic(request, component_id, width, height, format): from neurolab.db.models import * width, height = int(width), int(height) try: component = Component.objects.with_id(component_id) except Component.DoesNotExist: raise Http404 image, mimetype = component.grapher(request.GET).get_image(width, height, format) image.seek(0) return HttpResponse(image.read(), mimetype=mimetype) urlpatterns = patterns('', secured(r'^g/(?P<component_id>[0-9a-f]+)/(?P<width>\d+)x(?P<height>\d+)\.(?P<format>[a-z]+)$', component_graphic), )
except KeyError: raise Http404 return render_to_response("partials/db/component/process_form.html", { 'task': task, 'form': task.CriteriaForm(), 'cmp': component }) else: return render_to_response("partials/db/component/process.html", { 'cmp': component, }) urlpatterns = patterns('', secured(r'^$', index), secured(r'^new/$', new), secured(r'^(?P<ds_id>[0-9a-f]+)/edit/$', edit), secured(r'^(?P<ds_id>[0-9a-f]+)/delete/$', delete), secured(r'^(?P<ds_id>[0-9a-f]+)/output/new/$', output_new), secured(r'^(?P<ds_id>[0-9a-f]+)/output/(?P<op_id>[0-9a-f]+)/edit/$', output_edit), secured(r'^(?P<ds_id>[0-9a-f]+)/output/(?P<op_id>[0-9a-f]+)/delete/$', output_delete), secured(r'^(?P<ds_id>[0-9a-f]+)/blocks/(?P<block_id>[0-9a-f]+)/$', block_view), secured(r'^(?P<ds_id>[0-9a-f]+)/blocks/(?P<block_id>[0-9a-f]+)/delete/$', block_delete), secured(r'^(?P<ds_id>[0-9a-f]+)/blocks/(?P<block_id>[0-9a-f]+)/output/(?P<op_id>[0-9a-f]+)/make/$', block_output_make), secured(r'^(?P<ds_id>[0-9a-f]+)/blocks/(?P<block_id>[0-9a-f]+)/output/(?P<op_id>[0-9a-f]+)/discard/$', block_output_discard),
from neurolab.db.models import Datasource try: ds = Datasource.objects.with_id(ds_id) except Datasource.DoesNotExist: raise Http404 if refresh: ds.parsetree() return render_to_response('partials/datasources/sourcefile/list.html', {'datasource': ds} ) urlpatterns = patterns('', secured(r'^new/$', new), secured(r'^create/$', create), secured(r'^(?P<ds_id>[0-9a-f]+)/edit/$', edit), secured(r'^(?P<ds_id>[0-9a-f]+)/update/$', update), secured(r'^(?P<ds_id>[0-9a-f]+)/delete/$', delete), secured(r'^(?P<ds_id>[0-9a-f]+)/files/$', sourcefiles), secured(r'^(?P<ds_id>[0-9a-f]+)/files/refresh/$', sourcefiles, {'refresh': True}), secured(r'^(?P<ds_id>[0-9a-f]+)/files/(?P<file_id>[0-9a-f]+)/$', sourcefile), secured(r'^(?P<ds_id>[0-9a-f]+)/files/(?P<file_id>[0-9a-f]+)/structure/$', sourcefile_structure), secured(r'^(?P<ds_id>[0-9a-f]+)/files/(?P<file_id>[0-9a-f]+)/load/$', sourcefile_load), secured(r'^$', index), )