Beispiel #1
0
 def getViewRows(self,
                 includeDocs,
                 untilDate,
                 fromDate,
                 limit=None,
                 resumption_token=None):
     params = {
         'stale': 'ok',
         'include_docs': includeDocs,
         'endkey': h.convertToISO8601Zformat(untilDate),
         'startkey': h.convertToISO8601Zformat(fromDate),
     }
     if resumption_token is not None:
         params['startkey'] = resumption_token['startkey']
         params['endkey'] = resumption_token['endkey']
         params['startkey_docid'] = resumption_token['startkey_docid']
         params['skip'] = 1
     if limit is not None:
         params['limit'] = limit
     import json
     log.debug(json.dumps(params))
     return h.getView(
         database_url=self.db_url,
         view_name='_design/learningregistry-by-date/_view/docs',
         **params)
Beispiel #2
0
 def get_records_by_resource(self, resource_locator):
     view_data = h.getView(
         database_url=self.db_url,
         view_name='_design/learningregistry-resource-location/_view/docs',
         method="POST",
         include_docs=True,
         keys=[resource_locator],
         stale='ok')
     for doc in view_data:
         yield doc["doc"]
Beispiel #3
0
 def get_records_by_resource(self, resource_locator):
     view_data = h.getView(
         database_url=self.db_url,
         view_name="_design/learningregistry-resource-location/_view/docs",
         method="POST",
         include_docs=True,
         keys=[resource_locator],
         stale=appConfig["couchdb.stale.flag"],
     )
     for doc in view_data:
         yield doc["doc"]
Beispiel #4
0
 def getViewRows(self,includeDocs, untilDate,fromDate,limit=None,resumption_token=None):    
   params = {
       'stale':'ok',
       'include_docs':includeDocs,
       'endkey':h.convertToISO8601Zformat(untilDate),
       'startkey':h.convertToISO8601Zformat(fromDate),
   }    
   if resumption_token is not None:
       params['startkey'] = resumption_token['startkey']
       params['endkey'] = resumption_token['endkey']
       params['startkey_docid'] = resumption_token['startkey_docid']
       params['skip'] = 1
   if limit is not None:
       params['limit'] = limit
   return h.getView(database_url=self.db_url,view_name='_design/learningregistry-by-date/_view/docs',**params)    
Beispiel #5
0
    def getViewRows(self, includeDocs, untilDate, fromDate, limit=None, resumption_token=None):
        params = {
            "stale": appConfig["couchdb.stale.flag"],
            "include_docs": includeDocs,
            "endkey": h.convertToISO8601Zformat(untilDate),
            "startkey": h.convertToISO8601Zformat(fromDate),
        }
        if resumption_token is not None:
            params["startkey"] = resumption_token["startkey"]
            params["endkey"] = resumption_token["endkey"]
            params["startkey_docid"] = resumption_token["startkey_docid"]
            params["skip"] = 1
        if limit is not None:
            params["limit"] = limit
        import json

        log.debug(json.dumps(params))
        return h.getView(database_url=self.db_url, view_name="_design/learningregistry-by-date/_view/docs", **params)
Beispiel #6
0
 def list_identifiers(self, from_date, until_date):
   rows = h.getView(database_url=self.db_url,view_name='_design/learningregistry/_view/by-date',startkey=h.convertToISO8601Zformat(from_date),endkey=h.convertToISO8601Zformat(until_date), stale='ok')
   for row in rows:
         yield row["id"]
Beispiel #7
0
 def list_records(self, from_date, until_date):    
   rows = h.getView(database_url=self.db_url,view_name='_design/learningregistry/_view/by-date',startkey=h.convertToISO8601Zformat(from_date),endkey=h.convertToISO8601Zformat(until_date), include_docs=True, stale='ok')
   for row in rows:
       yield row["doc"]    
Beispiel #8
0
 def get_records_by_resource(self,resource_locator):
   view_data = h.getView(database_url=self.db_url,view_name='_design/learningregistry/_view/resource-location',method="POST",include_docs=True,keys=[resource_locator], stale='ok')
   for doc in view_data:
       yield doc["doc"]