Beispiel #1
0
    def harvest_source_view(self, id):
        try:
            # Check user authorization.
            user = self._get_required_authorization_credentials()
            am_authz = self.authorizer.is_sysadmin(user.name) # simple for now
            if not am_authz:
                self._abort_not_authorized('User %r not authorized for harvesting' % user.name)

            #source = get_harvest_source(id,default=None)
            source = get_harvest_source(id)
            if source is None:
                response.status_int = 404
                return 'Not found'

            return self._finish_ok(source)
        except ApiError, api_error:
            return self._finish(api_error.status_int, str(api_error.msg))
Beispiel #2
0
    def harvest_source_view(self, id):
        try:
            # Check user authorization.
            user = self._get_required_authorization_credentials()
            am_authz = self.authorizer.is_sysadmin(user.name)  # simple for now
            if not am_authz:
                self._abort_not_authorized(
                    'User %r not authorized for harvesting' % user.name)

            #source = get_harvest_source(id,default=None)
            source = get_harvest_source(id)
            if source is None:
                response.status_int = 404
                return 'Not found'

            return self._finish_ok(source)
        except ApiError, api_error:
            return self._finish(api_error.status_int, str(api_error.msg))
Beispiel #3
0
 def get_harvest_source_by_url(source_url, default=Exception):
     return get_harvest_source(source_url,attr='url',default=default)
Beispiel #4
0
 def get_harvest_source_by_url(source_url, default=Exception):
     return get_harvest_source(source_url, attr='url', default=default)