Exemplo n.º 1
0
    def dispatch(self, request, *args, **kwargs):
        self.prefix = self.get_prefix(request, *args, **kwargs)
        self.storage = get_storage(self.storage_name, self.prefix, request, getattr(self, 'file_storage', None))
        self.steps = StepsHelper(self)
        response = TemplateView.dispatch(self, request, *args, **kwargs)

        # update the response (e.g. adding cookies)
        self.storage.update_response(response)
        return response
Exemplo n.º 2
0
    def dispatch(self, request):
        try:
            start_distribution = Distribution.objects.get(
                status=DISTRIBUTION_STATUS_INITIAL)
        except Distribution.DoesNotExist:
            start_distribution = None
        if not all((self.check_permissions(request), start_distribution)):
            return HttpResponseForbidden(loader.render_to_string(
                '403.html', context_instance=RequestContext(request)))

        return TemplateView.dispatch(self, request, start_distribution)
Exemplo n.º 3
0
    def dispatch(self, *args, **kwargs):
        self.geo_id = self.kwargs.get('geography_id', None)
        self.slug = self.kwargs.get('slug', None)

        # if possible, redirect to slugged URL
        if not self.slug:
            geo = self.get_geography(self.geo_id)
            slug = slugify(geo.short_name)
            return HttpResponseRedirect('/profiles/%s-%s' % (self.geo_id, slug))

        # Skip the parent class's logic completely and go back to basics
        return TemplateView.dispatch(self, *args, **kwargs)
Exemplo n.º 4
0
    def dispatch(self, *args, **kwargs):
        self.geo_id = self.kwargs.get('geography_id', None)

        try:
            self.geo_level, self.geo_code = self.geo_id.split('-', 1)
            self.geo = geo_data.get_geography(self.geo_code, self.geo_level)
        except (ValueError, LocationNotFound):
            raise Http404

        # check slug
        if self.adjust_slugs and (kwargs.get('slug') or self.geo.slug):
            if kwargs['slug'] != self.geo.slug:
                kwargs['slug'] = self.geo.slug
                url = '/profiles/%s-%s-%s' % (self.geo_level, self.geo_code, self.geo.slug)
                return redirect(url, permanent=True)

        # Skip the parent class's logic completely and go back to basics
        return TemplateView.dispatch(self, *args, **kwargs)
Exemplo n.º 5
0
    def dispatch(self, *args, **kwargs):
        self.geo_id = self.kwargs.get('geography_id', None)

        try:
            self.geo_level, self.geo_code = self.geo_id.split('-', 1)
            self.geo = geo_data.get_geography(self.geo_code, self.geo_level)
        except (ValueError, LocationNotFound):
            raise Http404

        # check slug
        if self.adjust_slugs and (kwargs.get('slug') or self.geo.slug):
            if kwargs['slug'] != self.geo.slug:
                kwargs['slug'] = self.geo.slug
                url = '/profiles/%s-%s-%s' % (self.geo_level, self.geo_code,
                                              self.geo.slug)
                return redirect(url, permanent=True)

        # Skip the parent class's logic completely and go back to basics
        return TemplateView.dispatch(self, *args, **kwargs)
    def dispatch(self, request, *args, **kwargs):

        return TemplateView.dispatch(self, request, *args, **kwargs)
Exemplo n.º 7
0
 def dispatch(self, request, *args, **kwargs):
     return TemplateView.dispatch(self, request, *args, **kwargs)
Exemplo n.º 8
0
 def dispatch(self, request, *args, **kwargs):
     if "travels" not in request.session:
         return redirect("transportation-itinerary")
     return TemplateView.dispatch(self, request, *args, **kwargs)
Exemplo n.º 9
0
 def dispatch(self, request, sandbox, *args, **kwargs):
     self.sandbox_uuid = sandbox
     return TemplateView.dispatch(self, request, *args, **kwargs)
Exemplo n.º 10
0
 def dispatch(self, *args, **kwargs):
     self.geo_id = self.kwargs.get('geography_id', None)
     # Skip the parent class's logic completely and go back to basics
     return TemplateView.dispatch(self, *args, **kwargs)
Exemplo n.º 11
0
 def dispatch( self, request, *args, **kwargs ):
     if request.is_ajax():
         ''' a request for initial data from a javscript application'''
         data=initialData( request.user )
         return JsonResponse( data )
     return TemplateView.dispatch( self, request, *args, **kwargs )
Exemplo n.º 12
0
 def dispatch(self, *args, **kwargs):
     self.geo_id = self.kwargs.get("geography_id", None)
     # Skip the parent class's logic completely and go back to basics
     return TemplateView.dispatch(self, *args, **kwargs)