Mercurial > libervia-web
comparison src/server/pages.py @ 1071:8f77e36cd51d
pages: fixed args count in getPathArgs
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 21 Mar 2018 19:11:22 +0100 |
parents | 5f97118dc82a |
children | 63ed5f6bd4eb |
comparison
equal
deleted
inserted
replaced
1070:46622cb54e6c | 1071:8f77e36cd51d |
---|---|
587 else: | 587 else: |
588 try: | 588 try: |
589 value = data[name] = self.nextPath(request) | 589 value = data[name] = self.nextPath(request) |
590 except IndexError: | 590 except IndexError: |
591 data[name] = None | 591 data[name] = None |
592 idx-=1 | |
592 break | 593 break |
593 | 594 |
594 if idx + 1 < min_args: | 595 values_count = idx+1 |
595 log.warning(_(u"Missing arguments in URL (got {idx}, expected at least {min_args})").format( | 596 if values_count < min_args: |
596 idx = idx, min_args = min_args)) | 597 log.warning(_(u"Missing arguments in URL (got {count}, expected at least {min_args})").format( |
598 count = values_count, min_args = min_args)) | |
597 self.pageError(request, C.HTTP_BAD_REQUEST) | 599 self.pageError(request, C.HTTP_BAD_REQUEST) |
598 | 600 |
599 for name in names[idx+1:]: | 601 for name in names[values_count:]: |
600 data[name] = None | 602 data[name] = None |
601 | 603 |
602 for name, handler in kwargs.iteritems(): | 604 for name, handler in kwargs.iteritems(): |
603 if name[0] == '*': | 605 if name[0] == '*': |
604 data[name] = [self._filterPathValue(v, handler, name, request) for v in data[name]] | 606 data[name] = [self._filterPathValue(v, handler, name, request) for v in data[name]] |