예제 #1
0
    def __init__(self,
                 route,
                 model=None,
                 editavailable=None,
                 list_display_links=None,
                 object_display=None,
                 related_field=None,
                 url_bits_mapping=None,
                 routes=None,
                 always_load_fields=None,
                 **kwargs):
        self.model = model
        ResolverMixin.__init__(self, route)
        RendererMixin.__init__(self, **kwargs)
        if routes:
            base_routes = OrderedDict(((r.name, r) for r in self.base_routes))
            base_routes.update(((r.name, r) for r in routes))
            self.base_routes = list(itervalues(base_routes))
        else:
            self.base_routes = list(self.base_routes)
        if not self.pagination:
            self.pagination = html.Pagination()
        self.object_views = []
        self.model_url_bits = ()
        self.editavailable = editavailable if editavailable is not None else\
                                self.editavailable
        self.list_display_links = list_display_links or self.list_display_links
        self.related_field = related_field or self.related_field
        self.always_load_fields = always_load_fields or self.always_load_fields
        if self.parent_view and not self.related_field:
            raise UrlException('Parent view "{0}" specified in\
 application {1} without a "related_field".'.format(self.parent_view, self))
        self.object_display = object_display or self.object_display
        self.url_bits_mapping = self.url_bits_mapping or url_bits_mapping
        self.clear()
예제 #2
0
    def __init__(self, route, model=None, editavailable=None,
                 list_display_links=None, object_display=None,
                 related_field=None, url_bits_mapping=None,
                 routes=None, always_load_fields=None, **kwargs):
        self.model = model
        ResolverMixin.__init__(self, route)
        RendererMixin.__init__(self, **kwargs)
        if routes:
            base_routes = OrderedDict(((r.name,r) for r in self.base_routes))
            base_routes.update(((r.name,r) for r in routes))
            self.base_routes = list(itervalues(base_routes))
        else:
            self.base_routes = list(self.base_routes)
        if not self.pagination:
            self.pagination = html.Pagination()
        self.object_views = []
        self.model_url_bits = ()
        self.editavailable = editavailable if editavailable is not None else\
                                self.editavailable
        self.list_display_links = list_display_links or self.list_display_links
        self.related_field = related_field or self.related_field
        self.always_load_fields = always_load_fields or self.always_load_fields
        if self.parent_view and not self.related_field:
            raise UrlException('Parent view "{0}" specified in\
 application {1} without a "related_field".'.format(self.parent_view,self))
        self.object_display = object_display or self.object_display
        self.url_bits_mapping = self.url_bits_mapping or url_bits_mapping
        self.clear()
예제 #3
0
 def match(self, environ):
     view_args = ResolverMixin.match(self,
                                     environ.get('PATH_INFO', '/')[1:])
     if view_args:
         environ['websocket-request'] = WebSocketRequest(
             environ, *view_args)
         return True
예제 #4
0
 def __init__(self, route, settings):
     ResolverMixin.__init__(self, route)
     self.internals['settings'] = settings
예제 #5
0
 def __copy__(self):
     o = ResolverMixin.__copy__(self)
     o.clear()
     return o
예제 #6
0
 def __copy__(self):
     o = ResolverMixin.__copy__(self)
     o.clear()
     return o
예제 #7
0
파일: ws.py 프로젝트: pombredanne/djpcms
 def match(self, environ):
     view_args = ResolverMixin.match(self, environ.get('PATH_INFO', '/')[1:])
     if view_args:
         environ['websocket-request'] = WebSocketRequest(environ, *view_args)
         return True
예제 #8
0
파일: ws.py 프로젝트: pombredanne/djpcms
 def __init__(self, route, settings):
     ResolverMixin.__init__(self, route)
     self.internals['settings'] = settings