ResolverMatch and url pattern

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ResolverMatch and url pattern

Melvyn Sopacua

Hi,

 

I'm trying to implement a wrapper for Django's request to work with openapi-core. In this endavour I discovered that obtaining the pattern that matched with the current URL is not stored on ResolverMatch and I don't see any other way to obtain it from a Django HttpRequest.

 

I'm apparently not alone in this. And I'm wondering why it's not stored. I basically would have to setup a local url pattern cache tied to view name and resolve it again.

 

Is there a reason it's not stored on the resolver match?

--

Melvyn Sopacua

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4514516.McgpHlQW1J%40fritzbook.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: ResolverMatch and url pattern

Tim Graham-2
There's an open ticket. Perhaps you would like to finish the patch.

https://code.djangoproject.com/ticket/28766
https://github.com/django/django/pull/9323

On Tuesday, July 10, 2018 at 2:16:01 PM UTC-4, Melvyn Sopacua wrote:

Hi,

 

I'm trying to implement a wrapper for Django's request to work with <a href="https://github.com/p1c2u/openapi-core" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fp1c2u%2Fopenapi-core\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFKqrHHQzYy8Wt9iQVnv-5RnU2q_A&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fp1c2u%2Fopenapi-core\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFKqrHHQzYy8Wt9iQVnv-5RnU2q_A&#39;;return true;">openapi-core. In this endavour I discovered that obtaining the pattern that matched with the current URL is not stored on ResolverMatch and I don't see any other way to obtain it from a Django HttpRequest.

 

I'm apparently <a href="https://stackoverflow.com/questions/18653278/django-get-url-regex-by-name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F18653278%2Fdjango-get-url-regex-by-name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHp7z0dIj1q4OzR9FZovibnNoVL2Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F18653278%2Fdjango-get-url-regex-by-name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHp7z0dIj1q4OzR9FZovibnNoVL2Q&#39;;return true;">not alone in this. And I'm wondering why it's not stored. I basically would have to setup a local url pattern cache tied to view name and resolve it again.

 

Is there a reason it's not stored on the resolver match?

--

Melvyn Sopacua

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a87f2b43-b9c0-403a-8044-48c00f9c11f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: ResolverMatch and url pattern

Melvyn Sopacua
On dinsdag 10 juli 2018 21:09:21 CEST Tim Graham wrote:
> There's an open ticket. Perhaps you would like to finish the patch.
>
> https://code.djangoproject.com/ticket/28766
> https://github.com/django/django/pull/9323

I will have a look.

--
Melvyn Sopacua

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1557027.OhWQaSBghW%40fritzbook.
For more options, visit https://groups.google.com/d/optout.