| 427 | self._compile(method) |
| 428 | |
| 429 | def _compile(self, method): |
| 430 | all_rules = self.dyna_routes[method] |
| 431 | comborules = self.dyna_regexes[method] = [] |
| 432 | maxgroups = self._MAX_GROUPS_PER_PATTERN |
| 433 | for x in range(0, len(all_rules), maxgroups): |
| 434 | some = all_rules[x:x + maxgroups] |
| 435 | combined = (flatpat for (_, flatpat, _, _) in some) |
| 436 | combined = '|'.join('(^%s$)' % flatpat for flatpat in combined) |
| 437 | combined = re.compile(combined).match |
| 438 | rules = [(target, getargs) for (_, _, target, getargs) in some] |
| 439 | comborules.append((combined, rules)) |
| 440 | |
| 441 | def build(self, _name, *anons, **query): |
| 442 | """ Build an URL by filling the wildcards in a rule. """ |