Subversion Repositories SmartDukaan

Rev

Rev 13995 | Rev 13999 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13995 Rev 13998
Line 170... Line 170...
170
    cursor = collection.find({"userId":userId})
170
    cursor = collection.find({"userId":userId})
171
    total_count = cursor.count()
171
    total_count = cursor.count()
172
    pages = total_count/window + (0 if total_count%window==0 else 1)  
172
    pages = total_count/window + (0 if total_count%window==0 else 1)  
173
    print "total_count", total_count
173
    print "total_count", total_count
174
    if total_count > skip:
174
    if total_count > skip:
175
        cursor = cursor.skip(skip).limit(window)
175
        cursor = cursor.skip(skip).limit(window).sort([("$natural",-1)])
176
        orders = []
176
        orders = []
177
        for order in cursor:
177
        for order in cursor:
178
            del(order["_id"])
178
            del(order["_id"])
179
            orders.append(order)
179
            orders.append(order)
180
        result['data'] = orders
180
        result['data'] = orders