add unicode URLSpec support

Open
#89 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend, web-dev

Research direction

Start in tornado/web.py at URLSpec and inspect how its regular expression is compiled. Confirm that URLSpec patterns support Unicode matching as requested; the issue includes a proposed change but names no tests to run.

Written by the indexing model from the issue text.

Description

web

Please add unicode URLSpec support.

Patch:

diff --git a/tornado/web.py b/tornado/web.py
index e51948a..cd9a6a4 100644
--- a/tornado/web.py
+++ b/tornado/web.py
@@ -1368,7 +1368,7 @@ class URLSpec(object):
         """
         if not pattern.endswith('$'):
             pattern += '$'
-        self.regex = re.compile(pattern)
+        self.regex = re.compile(pattern, re.UNICODE)
         self.handler_class = handler_class
         self.kwargs = kwargs
         self.name = name
Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tornadoweb/tornado

All issues in tornadoweb/tornado

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.