def _build_query_url(self, page = None, verbose = False):
        """
        builds the url to call
        """
        query = []
#        # build the filters
#        for afilter in self.filters.keys():
#            value = self.filters[afilter]
#            print"filter:%s value:%s" % (afilter,value)
#            value = urlencode(value)
#            query_str = u"%s=%s" % (afilter, value)
        if len(self.filters) > 0:
            query.append(urlencode(self.filters))
        if self.sort:
            query_str = u"%s=%s" % (u"sort", self.sort)
            query.append(query_str)
        if self.sort_by:
            query_str = u"%s=%s" % (u"sort_by", self.sort_by)
            query.append(query_str)
        if self.per_page:
            query_str = u"%s=%s" % (u"per_page", self.per_page)
            query.append(query_str)
        if page:
            query_str = u"%s=%s" % (u"page", page)
            query.append(query_str)
        query = u"?%s" % (u"&".join(query))
        url = u"%s%s" % (self.get_list_endpoint()['href'],query)
        url = u"%s%s%s" % (self.__api__.base_url, API_BASE_PATH, url)
        msg = "_build_query_url: url:%s" % url
        log.debug(msg)
        if verbose:
            print msg
        return url
def _build_query_url ( self , page = None , verbose = False ) : query = [ ] if len ( self . filters ) > 0 : query . append ( urlencode ( self . filters ) ) if self . sort : query_str = u"%s=%s" % ( u"sort" , self . sort ) query . append ( query_str ) if self . sort_by : query_str = u"%s=%s" % ( u"sort_by" , self . sort_by ) query . append ( query_str ) if self . per_page : query_str = u"%s=%s" % ( u"per_page" , self . per_page ) query . append ( query_str ) if page : query_str = u"%s=%s" % ( u"page" , page ) query . append ( query_str ) query = u"?%s" % ( u"&" . join ( query ) ) url = u"%s%s" % ( self . get_list_endpoint ( ) [ 'href' ] , query ) url = u"%s%s%s" % ( self . __api__ . base_url , API_BASE_PATH , url ) msg = "_build_query_url: url:%s" % url log . debug ( msg ) if verbose : print msg return url
builds the url to call