No problem, I'll send you a diff patch :)
Thanks !
On 19 May 2012, at 21:42, Massimo Di Pierro wrote:
> yes please. Following this mailing list is getting more and more difficult
> and number of posts increases.
>
> On Friday, 18 May 2012 17:26:22 UTC-5, howesc wrote:
> you could submit a patch....it's more likely to get massimo to grab a patch.
> :)
>
> On Friday, May 18, 2012 1:06:55 AM UTC-7, Joseph.Piron wrote:
> Isn't it possible ? :(
>
> Le lundi 23 avril 2012 10:26:35 UTC+2, Joseph.Piron a écrit :
> Hi guys!
>
> I am using the wonderful db.parse_as_rest function in my development and like
> to ask if it is possible to push a modification in the trunk as as to be able
> to go on without custom code maintenance :)
> For paging purposes, I would need the output of this function to contain the
> total number of records returned by the request (before limits applies).
> Fortunately, this is already computed by the function:
> if i==len(tags) and table:
> ofields = vars.get('order',db[table]._id.name).split('|')
> try:
> orderby = [db[table][f] if not f.startswith('~') else
> ~db[table][f[1:]] for f in ofields]
> except KeyError:
> return Row({'status':400,'error':'invalid
> orderby','response':None})
> fields = [field for field in db[table] if field.readable]
> count = dbset.count()
> try:
> offset = int(vars.get('offset',None) or 0)
> limits = (offset,int(vars.get('limit',None) or
> 1000)+offset)
> except ValueError:
> Row({'status':400,'error':'invalid
> limits','response':None})
> if count > limits[1]-limits[0]:
> Row({'status':400,'error':'too many
> records','response':None})
> try:
> response =
> dbset.select(limitby=limits,orderby=orderby,*fields)
> except ValueError:
> return Row({'status':400,'pattern':pattern,
> 'error':'invalid path','response':None})
> return
> Row({'status':200,'response':response,'pattern':pattern})
>
>
>
> and so I would modify the last return to:
>
> return
> Row({'status':200,'response':response,'pattern':pattern,'count':count})
>
> Would this be acceptable ?
>
> Thanks in advance !!