Esempio n. 1
0
File: api.py Progetto: pvl/localwiki
 def base_urls(self):
     return [
         url(
             r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()),
             self.wrap_view("dispatch_list"),
             name="api_dispatch_list",
         ),
         url(
             r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()),
             self.wrap_view("get_schema"),
             name="api_get_schema",
         ),
         url(
             r"^(?P<resource_name>%s)/set/(?P<%s_list>\w[\w/;-]*)%s$"
             % (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()),
             self.wrap_view("get_multiple"),
             name="api_get_multiple",
         ),
         # Our lookup field.
         # Slugs can't start with the _ character or contain a
         # slash surrounded by the _ character. We do this so we can
         # define URLs for sub-resources more easily.
         url(
             r"^(?P<resource_name>%s)/(?P<%s>[^_]((?!(/_)|(_/)).)*?)%s$"
             % (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()),
             self.wrap_view("dispatch_detail"),
             name="api_dispatch_detail",
         ),
     ]
 def base_urls(self):
     return [
         url(r"^" + self.parent_resource_name + "/(?P<pk>\w[\w-]*)/(?P<resource_name>%s)%s$" %
             (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
         url(r"^" + self.parent_resource_name + "/(?P<pk>\w[\w-]*)/(?P<resource_name>%s)\.(?P<format>\w+)%s$" % (
             self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
     ]
Esempio n. 3
0
    def prepend_urls(self):

        return [
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/set-current%s$" % (
            self._meta.resource_name, trailing_slash()), self.wrap_view('set_current'),
                name="playlist_api_set_current"),
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/reorder%s$" % (self._meta.resource_name, trailing_slash()),
                self.wrap_view('reorder'), name="playlist_api_reorder"),
            # collecting
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/collect%s$" % (self._meta.resource_name, trailing_slash()),
                self.wrap_view('collect_specific'), name="playlist_api_collect_specific"),
            url(r"^(?P<resource_name>%s)/collect%s$" % (self._meta.resource_name, trailing_slash()),
                self.wrap_view('collect'), name="playlist_api_collect"),
            # services & hooks
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/mixdown-complete%s$" % (self._meta.resource_name, trailing_slash()),
                self.wrap_view('mixdown_complete'), name="alibrary-playlist_api-mixdown_complete"),
            # # autocomplete
            # url(r"^(?P<resource_name>%s)/autocomplete%s$" % (self._meta.resource_name, trailing_slash()),
            #     self.wrap_view('autocomplete'), name="alibrary-playlist_api-autocomplete"),
            #
            # # legacy
            # url(r"^(?P<resource_name>%s)/autocomplete-name%s$" % (self._meta.resource_name, trailing_slash()),
            #     self.wrap_view('autocomplete'), name="alibrary-playlist_api-autocomplete"),

        ]
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/jobs%s$" % (self._meta.resource_name,
             trailing_slash()), self.wrap_view('jobs'), name="jobs"),
         url(r"^(?P<resource_name>%s)/crawl%s$" % (self._meta.resource_name,
             trailing_slash()), self.wrap_view('crawl'), name="crawl"),
     ]
Esempio n. 5
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<asset_id>[0-9a-f]{32,32})%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_detail'),
             name="api_dispatch_detail"),
         url(r"^(?P<resource_name>%s)/stories/(?P<story_id>[0-9a-f]{32,32})%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_list'),
             name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)/stories/(?P<story_id>[0-9a-f]{32,32})/featured%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_featured_list'),
             kwargs={'featured': True},
             name="api_dispatch_featured_list"),
         url(r"^(?P<resource_name>%s)/stories/(?P<story_id>[0-9a-f]{32,32})/sections/none%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_list'),
             kwargs={'no_section': True},
             name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)/sections/(?P<section_id>[0-9a-f]{32,32})%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_list'),
             name="api_dispatch_list"),
     ]
Esempio n. 6
0
	def base_urls(self):
		return [
	        url(r"^(?P<website_togo>\w+)%s$" % (trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
	        url(r"^(?P<website_togo>\w+)/schema%s$" % (trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
	        url(r"^(?P<website_togo>\w+)/set/(?P<pk_list>\w[\w/;-]*)/$", self.wrap_view('get_multiple'), name="api_get_multiple"),
	        url(r"^(?P<website_togo>\w+)/(?P<pk>\w[\w/-]*)%s$" % (trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
	    ]
Esempio n. 7
0
def actionurls(self):
    urls = []
    for name, method in self.__class__.__dict__.iteritems():
        if hasattr(method, "is_auto_action"):

            actionName = name if not hasattr(method, "auto_action_name") \
                else method.auto_action_name

            if hasattr(method, "auto_action_url"):
                urls.append(
                    url(method.auto_action_url,
                        self.wrap_view(name),
                        name="api_action_%s" % actionName)
                )
            else:
                if not method.auto_action_static:
                    urls.append(
                        url(r"^(?P<resource_name>%s)/(?P<%s>[A-Za-z0-9]+)/%s%s$" % (
                            self._meta.resource_name,
                            self._meta.detail_uri_name,
                            actionName,
                            trailing_slash()),
                            self.wrap_view(name),
                            name="api_action_static_%s" % actionName)
                    )
                else:
                    urls.append(
                        url(r"^(?P<resource_name>%s)/%s%s$" % (
                            self._meta.resource_name,
                            actionName,
                            trailing_slash()),
                            self.wrap_view(name),
                            name="api_action_%s" % actionName)
                    )
    return urls
Esempio n. 8
0
 def base_urls(self):
     return [
         url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
         url(r"^(?P<resource_name>%s)/set/(?P<pk_list>\w[\w;-]*)/$" % self._meta.resource_name, self.wrap_view('get_multiple'), name="api_get_multiple"),
         url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w-]*)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
         ]
Esempio n. 9
0
	def prepend_urls(self):
		return [
			url(r'^(?P<resource_name>%s)/addfavr%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('addFavR'), name = 'addFavR'),
			url(r'^(?P<resource_name>%s)/addfavu%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('addFavU'), name = 'addFavU'),
			url(r'^(?P<resource_name>%s)/removefavr%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('removeFavR'), name = 'removeFavR'),
			url(r'^(?P<resource_name>%s)/removefavu%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('removeFavU'), name = 'removeFavU'),
		]
Esempio n. 10
0
	def prepend_urls(self):
		return [
			url(r"^(?P<resource_name>%s)/login%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('login'), name="api_login"),
			url(r'^(?P<resource_name>%s)/logout%s$' %(self._meta.resource_name, trailing_slash()),self.wrap_view('logout'), name='api_logout'),
			url(r'^(?P<resource_name>%s)/register%s$' %(self._meta.resource_name, trailing_slash()),self.wrap_view('register'), name='api_register'),
			url(r'^(?P<resource_name>%s)/save_settings%s$' %(self._meta.resource_name, trailing_slash()),self.wrap_view('save_settings'), name='api_save_settings'),
		]
Esempio n. 11
0
    def prepend_urls(self):

        return [

            url(r"^(?P<resource_name>%s)/(?P<pk>[0-9]+)%s$" %
            (self._meta.resource_name, trailing_slash()),
            self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),

            url(r"^(?P<resource_name>%s)/autocomplete%s$" %
            (self._meta.resource_name, trailing_slash()),
            self.wrap_view('autocomplete'), name="api_tag_autocomplete"),

            url(r"^(?P<resource_name>%s)/trending%s$" %
            (self._meta.resource_name, trailing_slash()),
            self.wrap_view('get_trending'), name="api_tag_trending"),

            url(r"^(?P<resource_name>%s)/nearby%s$" %
            (self._meta.resource_name, trailing_slash()),
            self.wrap_view('get_nearby'), name="api_tag_nearby"),

            url(r"^(?P<resource_name>%s)/by_name/(?P<tag>[\w\d]+)%s$" %
            (self._meta.resource_name, trailing_slash()),
            self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),

        ]
Esempio n. 12
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/login%s$" %(self._meta.resource_name, 
             trailing_slash()), self.wrap_view('login'), name="api_login"),
         url(r"^(?P<resource_name>%s)/logout%s$" %(self._meta.resource_name, 
             trailing_slash()), self.wrap_view('logout'), name='api_logout'),
     ]
Esempio n. 13
0
    def prepend_urls(self):
        """
        1) + 2)
        Allow login and logout via the API

        cf. http://stackoverflow.com/questions/11770501/how-can-i-login-to-django-using-tastypie

        3)
        Allow negative primary key when requesting individual user
        (Django Guardian has the convention that there exists an AnonymousUser with id=-1)

        cf https://github.com/toastdriven/django-tastypie/pull/395/files

        """
        return [
            url(r"^(?P<resource_name>%s)/login%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('login'), name="api_login"),
            url(r'^(?P<resource_name>%s)/logout%s$' %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('logout'), name='api_logout'),
            url(r"^(?P<resource_name>%s)/(?P<pk>-?\w[\w/-]*)%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('dispatch_detail'), name="api_dispatch_detail")
        ]
Esempio n. 14
0
 def prepend_urls(self):
     return [
         url(r"(?P<resource_name>%s)/post%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('post_article'),name="api_post_article"),
         url(r"(?P<resource_name>%s)/comment%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('comment_article'),name="api_comment_article"),
         url(r"(?P<resource_name>%s)/like%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('like_article'),name="api_like_article"),
         url(r"(?P<resource_name>%s)/list%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('list_article'),name="api_list_article"),
     ]
 def base_urls(self):
     """
     Same as the original ``base_urls`` but supports using the custom
     url_id_attribute instead of the pk of the objects.
     """
     # Due to the way Django parses URLs, ``get_multiple``
     # won't work without a trailing slash.
     return [
         url(r"^(?P<resource_name>%s)%s$" %
                 (self._meta.resource_name, trailing_slash()),
                 self.wrap_view('dispatch_list'),
                 name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)/schema%s$" %
                 (self._meta.resource_name, trailing_slash()),
                 self.wrap_view('get_schema'),
                 name="api_get_schema"),
         url(r"^(?P<resource_name>%s)/set/(?P<%s_list>(%s;?)*)/$" %
                 (self._meta.resource_name,
                  self._meta.url_id_attribute,
                  self.get_url_id_attribute_regex()),
                 self.wrap_view('get_multiple'),
                 name="api_get_multiple"),
         url(r"^(?P<resource_name>%s)/(?P<%s>%s)%s$" %
                 (self._meta.resource_name,
                  self._meta.url_id_attribute,
                  self.get_url_id_attribute_regex(),
                  trailing_slash()),
                  self.wrap_view('dispatch_detail'),
                  name="api_dispatch_detail"),
     ]
Esempio n. 16
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/signin%s$" % (self._meta.resource_name, trailing_slash()),
             self.wrap_view('signin'), name='signin_api'),
         url(r"^(?P<resource_name>%s)/signout%s$" % (self._meta.resource_name, trailing_slash()),
             self.wrap_view('signout'), name='signout_api'),
     ]
 def prepend_urls(self):
     """ Add the following array of urls to the UserResource base urls """
     resource_name = self._meta.resource_name
     return [
         # register
         url(r"^(?P<resource_name>%s)/register%s$" %
             (resource_name, trailing_slash()),
             self.wrap_view('register'), name="api_register"),
         # login
         url(r"^(?P<resource_name>%s)/login%s$" %
             (resource_name, trailing_slash()),
             self.wrap_view('login'), name="api_login"),
         # logout
         url(r'^(?P<resource_name>%s)/logout%s$' %
             (resource_name, trailing_slash()),
             self.wrap_view('logout'), name='api_logout'),
         # is_authenticated
         url(r'^(?P<resource_name>%s)/is_authenticated%s$' %
             (resource_name, trailing_slash()),
             self.wrap_view('authenticated'), name='api_authenticated'),
         # recover password
         url(r'^(?P<resource_name>%s)/recover_password%s$' %
             (resource_name, trailing_slash()),
             self.wrap_view('recover_password'),
             name='api_recover_password'),
     ]
Esempio n. 18
0
    def prepend_urls(self):

        return [

            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/schedule%s$" % (
                self._meta.resource_name,
                trailing_slash()),
                self.wrap_view('get_schedule'),
                name="playlist_api_schedule"),

            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/history%s$" % (
                self._meta.resource_name,
                trailing_slash()),
                self.wrap_view('get_history'),
                name="playlist_api_history"),

            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/on-air%s$" % (
                self._meta.resource_name,
                trailing_slash()),
                self.wrap_view('get_now_playing'),
                name="playlist_api_on_air"),

            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/program%s$" % (
                self._meta.resource_name,
                trailing_slash()),
                self.wrap_view('get_program'),
                name="channel_api_program"),
        ]
Esempio n. 19
0
  def prepend_urls(self):
      return [
          url(r"^(?P<resource_name>%s)/login%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('user_login'), name="api_login"),
          url(r"^(?P<resource_name>%s)/change_password%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('change_password'), name="api_change_password"),
          url(r"^(?P<resource_name>%s)/update_password%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('update_password'), name="api_update_password"),
          url(r"^(?P<resource_name>%s)/forgot_password%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('forgot_password'), name="api_forgot_password"),
          url(r"^(?P<resource_name>%s)/new%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('new_user'), name="api_new_user"),
          url(r"^(?P<resource_name>%s)/update%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('update_user'), name="api_update_user"),
          url(r"^(?P<resource_name>%s)/edit%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('edit_user'), name="api_edit_user"),
          url(r"^user/logout/$", self.wrap_view('logout'), name='api_logout'),
          url(r"^(?P<resource_name>%s)/view%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('get_cards'), name="api_get_cards"),
          url(r"^(?P<resource_name>%s)/add_cards%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('add_cards'), name="add_cards"),
          url(r"^(?P<resource_name>%s)/balance%s$" %
              (self._meta.resource_name, trailing_slash()),
              self.wrap_view('balance'), name="add_cards"),
 
      ]
Esempio n. 20
0
    def prepend_urls(self):
        return [
            url(r"^(?P<resource_name>%s)/pass%s$" % (self._meta.resource_name, trailing_slash()),
                self.wrap_view('test_pass'), name='test_pass'),

            url(r"^(?P<resource_name>%s)/refresh%s$" % (self._meta.resource_name, trailing_slash()),
                self.wrap_view('refresh'), name='refresh'),
        ]
Esempio n. 21
0
 def override_urls(self):
     return [
         url(r"(?P<resource_name>%s)/login%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('login'),name="api_login"),
         url(r"(?P<resource_name>%s)/logout%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('logout'),name="api_logout"),
         url(r"(?P<resource_name>%s)/register%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('register'),name="api_register"),
         url(r"(?P<resource_name>%s)/changepassword%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('changepassword'),name="api_changepassword"),
         url(r"(?P<resource_name>%s)/userexist%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('userexist'),name="api_userexist"),
     ]
Esempio n. 22
0
 def override_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/attempt%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('logexercise'), name="api_logexe"),
         url(r"^(?P<resource_name>%s)/hint%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('logexercisehint'), name="api_logexeh"),
         url(r"^(?P<resource_name>%s)/attemptpe%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('logpeexercise'), name="api_logpeexe"), #return success and isproficient??
         url(r"^(?P<resource_name>%s)/avbutton%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('logavbutton'), name="api_logavbutt"),
          url(r"^(?P<resource_name>%s)/getprogress%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('getprogress'), name="api_getprogress"),
     ]
Esempio n. 23
0
File: v0.py Progetto: jness/dmirr
 def override_urls(self):
     return [
         url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
         url(r"^(?P<resource_name>%s)/set/(?P<pk_list>\w[\w/;-]*)/$" % self._meta.resource_name, self.wrap_view('get_multiple'), name="api_get_multiple"),
         url(r"^(?P<resource_name>%s)/(?P<username>[a-zA-Z][\w\d\_\.\-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
         
     ]
Esempio n. 24
0
	def prepend_urls(self):
		return [
			url(r'^(?P<resource_name>%s)/login%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('login'), name = 'api_login'),
			url(r'^(?P<resource_name>%s)/logout%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('logout'), name = 'api_logout'),
			url(r'^(?P<resource_name>%s)/changepassword%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('changePassword'), name = 'changePassword'),
			url(r'^(?P<resource_name>%s)/changeemail%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('changeEmail'), name = 'changeEmail'),
			url(r'^(?P<resource_name>%s)/feedback%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('feedback'), name = 'feedback'),
			]
Esempio n. 25
0
 def base_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash(),), self.wrap_view('get_schema'), name="api_get_schema"),
         url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_detail'), name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)\.(?P<format>\w+)%s$" % (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dispatch_detail'), name="api_dispatch_list"),
     ]
Esempio n. 26
0
 def prepend_urls(self):
     return [url(r"^(?P<resource_name>%s)/settings%s$"
                 % (self._meta.resource_name, trailing_slash()),
                 self.wrap_view('user_settings'), name="api_user_settings"),
             url(r"^(?P<resource_name>%s)/find%s$"
                 % (self._meta.resource_name, trailing_slash()),
                 self.wrap_view('user_find'), name="api_user_find")
             ]
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash())
             , self.wrap_view('handle_course_request')),
         url(r"^(?P<resource_name>%s)/(?P<pk>[\w/-]*)%s$" %
             (self._meta.resource_name, trailing_slash())
             , self.wrap_view('handle_course_request')),
     ]
Esempio n. 28
0
 def override_urls(self):
   return [
       url(r"^(?P<resource_name>%s)/bulk%s$" % 
           (self._meta.resource_name, trailing_slash()), 
           self.wrap_view('bulk_add'), name="api_bulk_add"),
       url(r"^(?P<resource_name>%s)/add_user%s$" %
           (self._meta.resource_name, trailing_slash()),
           self.wrap_view('add_user'), name="api_add_user"),
   ]
Esempio n. 29
0
 def prepend_urls(self):
     return [url(r"^(?P<resource_name>%s)/search%s$" %
                 (self._meta.resource_name, trailing_slash()),
                 self.wrap_view('get_search'),
                 name="api_get_search"),
             url(r"^(?P<resource_name>%s)/updatecheck%s$" %
                 (self._meta.resource_name, trailing_slash()),
                 self.wrap_view('update_check'),
                 name="api_update_check"), ]
Esempio n. 30
0
 def override_urls(self):
   return [
     url(r"^(?P<resource_name>%s)\.(?P<format>\w+)/search%s$" % 
           (self._meta.resource_name, trailing_slash()),
           self.wrap_view('get_search'), name="api_get_search"),
     url(r"^(?P<resource_name>%s)/bulk%s$" % 
           (self._meta.resource_name, trailing_slash()), 
           self.wrap_view('bulk_add'), name="api_bulk_add"),
   ]
Esempio n. 31
0
 def override_urls(self):
     return [
         url(r"^(?P<resource_name>%s)\.(?P<format>\w+)/stats%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_stats'),
             name="api_get_stats"),
     ]
Esempio n. 32
0
    def urls(self):
        """
        Provides URLconf details for the ``Api`` and all registered
        ``Resources`` beneath it.
        """
        if not self._accept_header_routing:
            pattern_list = [
                url(r"^(?P<api_name>%s)%s$" %
                    (self.api_name, trailing_slash()),
                    self.wrap_view('top_level'),
                    name="api_%s_top_level" % self.api_name),
            ]
        else:
            pattern_list = [
                url(r"^$",
                    self.wrap_view('top_level'),
                    name="api_%s_top_level" % self.api_name),
            ]

        for name in sorted(self._registry.keys()):
            self._registry[name].api_name = self.api_name
            if self._accept_header_routing:
                pattern_list.append(('', include(self._registry[name].urls)))
            else:
                pattern_list.append((r"^(?P<api_name>%s)/" % self.api_name,
                                     include(self._registry[name].urls)))

        urlpatterns = self.prepend_urls()

        urlpatterns += patterns('', *pattern_list)
        return urlpatterns
Esempio n. 33
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/analytics%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_analytics_pageviews'),
             name="api_get_analytics_pageviews"),
     ]
Esempio n. 34
0
 def prepend_urls(self):
     return [
         url(r'^(?P<resource_name>%s)/dismiss_all%s$' %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('dismiss_all'),
             name='api_command_dismiss_all'),
     ]
Esempio n. 35
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>book)/(?P<pk>(0|[1-9][0-9]*))/%ss%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_annotations'),
             name="api_annotations"),
     ]
Esempio n. 36
0
    def urls(self):
        """
        Provides URLconf details for the ``Api`` and all registered
        ``Resources`` beneath it.
        """
        
        from django.conf.urls.defaults import url, include, patterns
        from tastypie.utils import trailing_slash
        from client.views import checkin, checkout, login, logout, register, create_anonymous, delete_anonymous
        
        pattern_list = [
            url(r"^(?P<api_name>%s)%s$" % (self.api_name, trailing_slash()), self.wrap_view('top_level'), name="api_%s_top_level" % self.api_name),
        ]

        for name in sorted(self._registry.keys()):
            self._registry[name].api_name = self.api_name
            pattern_list.append((r"^(?P<api_name>%s)/resources/" % self.api_name, include(self._registry[name].urls)))

        ## then add the actions
        pattern_list.extend([
            url(r"^%s/actions/create_anonymous/$" % self.api_name, create_anonymous, name="create_anonymous"),
            url(r"^%s/actions/delete_anonymous/$" % self.api_name, delete_anonymous, name="delete_anonymous"),
            url(r"^%s/actions/register/$" % self.api_name, register, name="register"),
            url(r"^%s/actions/login/$" % self.api_name, login, name="login"),
            url(r"^%s/actions/logout/$" % self.api_name, logout, name="logout"),
            url(r"^%s/actions/checkin/$" % self.api_name, checkin, name="checkin"),
            url(r"^%s/actions/checkout/$" % self.api_name, checkout, name="checkout")
        ])

        urlpatterns = self.override_urls() + patterns('',
            *pattern_list
        )
        return urlpatterns
Esempio n. 37
0
 def override_urls(self):
     return [
         url(r'^(?P<resource_name>%s)/featured%s$' %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('with_featured'),
             name='api_with_featured'),
     ]
Esempio n. 38
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>{0})/(?P<pk>\d+)/configure{1}$".format(
             self._meta.resource_name, trailing_slash()),
             self.wrap_view('import_layer'),
             name="importer_configure"),
     ]
Esempio n. 39
0
    def urls(self):
        """
        Provides URLconf details for the ``Api`` and all registered
        ``Resources`` beneath it.
        """
        if self.api_name:
            api_pattern = '(?P<api_name>%s)'
            top_level = r"^%s%s$" % (api_pattern, trailing_slash())
        else:
            api_pattern = '(?P<api_name>)'
            top_level = r"^$"

        pattern_list = [
            url(top_level, self.wrap_view('top_level'), name="%s_rest_url" % self.app_name),
        ]

        for name in sorted(self._registry.keys()):
            resource = self._registry[name]
            resource.api_name = self.api_name
            pattern_list.append((r"^%s" % api_pattern, include(resource.urls)))

        urlpatterns = self.prepend_urls()

        overridden_urls = self.override_urls()
        if overridden_urls:
            warnings.warn("'override_urls' is a deprecated method & will be removed by v1.0.0. Please rename your method to ``prepend_urls``.")
            urlpatterns += overridden_urls

        urlpatterns += patterns('', *pattern_list)
        return urlpatterns
Esempio n. 40
0
 def override_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/search%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_search'),
             name="api_get_search"),
     ]
Esempio n. 41
0
 def prepend_urls(self):
     """
     Returns a URL scheme based on the default scheme to specify
     the response format as a file extension, e.g. /api/v1/users.json
     """
     return [
         url(r"^(?P<resource_name>%s)/search%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_search'),
             name="api_get_search"),
         url(r"^(?P<resource_name>%s)/search\.(?P<format>xml|json|jsonp|yaml)$"
             % self._meta.resource_name,
             self.wrap_view('get_search'),
             name="api_get_search"),
         url(r"^(?P<resource_name>%s)/datatables\.(?P<format>\w+)$" %
             self._meta.resource_name,
             self.wrap_view('get_datatables'),
             name="api_get_datatables"),
         url(r"^(?P<resource_name>%s)\.(?P<format>\w+)$" %
             self._meta.resource_name,
             self.wrap_view('dispatch_list'),
             name="api_dispatch_list"),
         url(r"^(?P<resource_name>%s)/schema\.(?P<format>\w+)$" %
             self._meta.resource_name,
             self.wrap_view('get_schema'),
             name="api_get_schema"),
         url(r"^(?P<resource_name>%s)/set/(?P<%s_list>\w[\w/;-]*)\.(?P<format>\w+)$"
             % (self._meta.resource_name, self._meta.detail_uri_name),
             self.wrap_view('get_multiple'),
             name="api_get_multiple"),
         url(r"^(?P<resource_name>%s)/(?P<%s>\w[\w/-]*)\.(?P<format>\w+)$" %
             (self._meta.resource_name, self._meta.detail_uri_name),
             self.wrap_view('dispatch_detail'),
             name="api_dispatch_detail"),
     ]
Esempio n. 42
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/login%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('login'),
             name="api_login"),
     ]
Esempio n. 43
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/bookmarks%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_bookmarks'),
             name="api_get_list_bookmarks"),
     ]
Esempio n. 44
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/politicians%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('all_related_current_politicians'),
             name="api_all_related_current_politicians"),
     ]
Esempio n. 45
0
    def urls(self):
        """
        Provides URLconf details for the ``Api`` and all registered
        ``Resources`` beneath it.
        """
        pattern_list = [
            url(r"^(?P<api_name>%s)%s$" % (self.api_name, trailing_slash()),
                self.wrap_view('top_level'),
                name="api_%s_top_level" % self.api_name),
        ]

        for name in sorted(self._registry.keys()):
            self._registry[name].api_name = self.api_name
            # refactored to `url`
            # https://github.com/django-tastypie/django-tastypie/blob/v0.13.0/tastypie/api.py
            pattern_list.append(
                url(r"^(?P<api_name>%s)/" % self.api_name,
                    include(self._registry[name].urls)))

        urlpatterns = self.prepend_urls()

        if self.override_urls():
            warnings.warn(
                "'override_urls' is a deprecated method & will be removed by v1.0.0. Please rename your method to ``prepend_urls``."
            )
            urlpatterns += self.override_urls()

        for pattern in pattern_list:
            urlpatterns.append(pattern)

        # urlpatterns += patterns('',
        #     *pattern_list
        # )

        return urlpatterns
Esempio n. 46
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/swarm%s$" %
             (self._meta.resource_name, trailing_slash()),
             auth_required(self.wrap_view('do_swarm')),
             name="api_do_swarm"),
     ]
Esempio n. 47
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/register%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('register'),
             name="api_event_register"),
     ]
Esempio n. 48
0
 def prepend_urls(self):
     return [
         url(r"^(%s)/sendMsg%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('sendMsg'),
             name="api_sendMsg"),
     ]
Esempio n. 49
0
    def prepend_urls(self):

        return [
            url(r"^(?P<resource_name>%s)/profile-image%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('upload_profile_image'), name="api_upload_profile_image"),
        ]
Esempio n. 50
0
 def override_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/get_pending_assessment%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_pending_assessment'),
             name="api_get_pending_assessment")
     ]
Esempio n. 51
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/install%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('install'),
             name="bulk_install"),
         url(r"^(?P<resource_name>%s)/restart-server%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('restart_server'),
             name="restart_server"),
         self._build_url_exp('install'),
         self._build_url_exp('reorder'),
         self._build_url_exp('uninstall', True),
         self._build_url_exp('suspend', True),
         self._build_url_exp('activate', True),
     ]
Esempio n. 52
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<slug>\w+)/upload%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('upload'),
             name='api_upload'),
     ]
Esempio n. 53
0
 def prepend_urls(self):
     """ Add the following array of urls to the Tileset base urls """
     return [
         url(r"^(?P<resource_name>%s)/auto_populate%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('auto_populate'), name="api_auto_populate"),
     ]
Esempio n. 54
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/calendar%s$" % (
             self._meta.resource_name, trailing_slash()),
             self.wrap_view('get_calendar'),
             name="api_get_calendar"),
     ]
Esempio n. 55
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<id>\d+)/download%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('download'),
             name='api_download'),
     ]
Esempio n. 56
0
    def prepend_urls(self):
        return [
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/users%s$" % (
                self._meta.resource_name, trailing_slash()),
                self.wrap_view('get_users'), name="api_project_users"),

        ]
Esempio n. 57
0
    def base_urls(self):
        urls = []

        urlexp = r'^(?P<resource_name>%s)/example/'
        urlexp %= self._meta.resource_name
        urls.append(
            url(urlexp,
                self.wrap_view('get_testdata_data_view'),
                name='get_testdata_data_view'))

        urlexp_2 = r'^(?P<resource_name>%s)/schema/'
        urlexp_2 %= self._meta.resource_name
        urls.append(
            url(urlexp_2,
                self.wrap_view('get_doc_data_view'),
                name='api_get_doc_data'))

        upload_url = r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/attach%s$"
        upload_url %= (self._meta.resource_name, trailing_slash())
        urls.append(
            url(upload_url,
                self.wrap_view("attach_upload"),
                name="api_attach_upload"))

        urls += super(ModelResource, self).base_urls()
        return urls
Esempio n. 58
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('tag_detail'),
             name="api_tag_detail"),
     ]
Esempio n. 59
0
 def override_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/not_interested%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('not_interested'),
             name="api_not_interested"),
     ]
Esempio n. 60
0
 def prepend_urls(self):
     return [
         url(r"^(?P<resource_name>%s)/convert_value%s$" %
             (self._meta.resource_name, trailing_slash()),
             self.wrap_view('convert_value'),
             name="api_teste"),
     ]