New to Django. Trying to wrap my head around markdown to html conversion using regex

2020-02-20 Thread Joey Jo Jo Jr
Hello all, I'm working on a class assignment, so I'm not seeking a specific answer/code, but I'm just trying to figure out a general process. The task is this... I have some markdown files located in a directory, however when running the website they need to be displayed as html. Because this

Re: Write urls without regex in DRF

2019-05-23 Thread nm
routers.py), which, among others, does: regex = route.url.format( prefix=prefix, lookup=lookup, trailing_slash=self.trailing_slash ) where `route.url` is something like url=r'^{prefix}/{lookup}{trailing_slash}$', and `prefix` is the first argument you pass to `router

Re: Write urls without regex in DRF

2019-05-22 Thread Rounak Jain
ible to write the code below without using regex? >> Thanks >> >> from .views import TaskViewSet >> from rest_framework.routers import DefaultRouter >> >> router = DefaultRouter() >> router.register(r'', TaskViewSet, basename='task') >&

Re: Write urls without regex in DRF

2019-05-22 Thread Kevin Jay
kevin@kjay,net On Wed, May 22, 2019 at 10:19 AM Rounak Jain wrote: > > I am using DRF Viewsets to auto-generate URLs for different views. Is it > possible to write the code below without using regex? > Thanks > > from .views import TaskViewSet > from rest_framework.routers

Re: Write urls without regex in DRF

2019-05-22 Thread Rounak Jain
Thanks for the reply. I understand how to use them in urls.py when creating normal routes but here in case of drf, it would help if you could show me how to do it On Wed, May 22, 2019 at 10:11 PM Onasanya Tunde wrote: > Use Django2.X > > -- > You received this message because you are subscribed

Write urls without regex in DRF

2019-05-22 Thread Onasanya Tunde
Use Django2.X -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@google

Write urls without regex in DRF

2019-05-22 Thread Rounak Jain
I am using DRF Viewsets to auto-generate URLs for different views. Is it possible to write the code below without using regex? Thanks from .views import TaskViewSet from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register(r'', TaskViewSet, base

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-25 Thread Mikkel Kromann
Thank you so much for your help, Melvyn. With your help I managed to the the code running :) Here it is, if somebody should find it helpful. cheers, Mikkel >From somewhere, e.g. models.py # The list of model names (just add your model names to it) def GetItemNames(): return [ 'Year', 'Vintage

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 14:30:08 CEST Mikkel Kromann wrote: > In models.py: > def GetItemPaths():paths = [ ] > for i in [ 'Model1', 'Model2', 'Model3' ]: > p = path( i + '/list/', ItemListView.as_view(model=i), name=i + > '_list' ) > paths.append(p) > > return paths >

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-23 Thread Mikkel Kromann
So, I think I have a neat idea for solving my problem, simply make a function which returns a list of path() returns. In urls.py urlpatterns = GetItemPaths() + [ # other paths ] In models.py: def GetItemPaths():paths = [ ] for i in [ 'Model1', 'Model2', 'Model3' ]: p = path( i +

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-21 Thread Melvyn Sopacua
On donderdag 21 juni 2018 10:19:08 CEST Mikkel Kromann wrote: > However, I'd really like to give all my urls names so that they can be > easily reversed (e.g. success links). > urlpatterns = [ > path('list//',ItemListView.as_view(), name= > mName+'_list'), > ] > > From what I

Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-21 Thread Mikkel Kromann
I have a lot of models (say 30 or 40) which are so similar, that I have handled them using slightly modified class based views. In urls.py: urlpatterns = [ path('list//',ItemListView.as_view()), path('create//', ItemCreateView.as_view()), path('update//', Ite

Re: Regex Validators doesn't validate while working in a shell

2016-09-12 Thread Daniel Roseman
On Monday, 12 September 2016 14:36:23 UTC+1, ashish...@finoit.co.in wrote: > > I've configured user's username field in following way > > username = models.CharField( > _('username'), > max_length=30, > unique=True, > help_text=_('Required. 30 characters or fewer. Le

Regex Validators doesn't validate while working in a shell

2016-09-12 Thread ashish . goyal
I've configured user's username field in following way username = models.CharField( _('username'), max_length=30, unique=True, help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'), validators=[ validators.RegexVal

which regex are for filtering malicious input in django?

2016-06-09 Thread meInvent bbird
which regex are for filtering malicious input in django? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.

Re: Don't understand regex-urls and DetailView...

2015-03-11 Thread inoyon artlover KLANGRAUSCH
I got it! :D (?P\w+) and NOT (P? . Am Mittwoch, 11. März 2015 21:57:34 UTC+1 schrieb inoyon artlover KLANGRAUSCH: > > I don't understand why this doesn't work and smashes an > > '*The current URL, lighter, didn't match any of these.'* > > my models.py > > class ShopList(models.Model): >

Don't understand regex-urls and DetailView...

2015-03-11 Thread inoyon artlover KLANGRAUSCH
I don't understand why this doesn't work and smashes an '*The current URL, lighter, didn't match any of these.'* my models.py class ShopList(models.Model): name = models.CharField(max_length=100, null=True, blank=True) description = models.CharField(max_length=100, null=True, blank=True

Re: Find duplicates with regex

2015-01-25 Thread Stephen J. Butler
pull out all the records and do the count/filter with Python code. On Sun, Jan 25, 2015 at 10:58 PM, wrote: > I posted this question to stackover flow but didn't get a good answer: > http://stackoverflow.com/questions/28080545/django-find-duplicates-with-queryset-and-regex > >

Find duplicates with regex

2015-01-25 Thread yakkadesign
I posted this question to stackover flow but didn't get a good answer: http://stackoverflow.com/questions/28080545/django-find-duplicates-with-queryset-and-regex I want to find duplicates in db fields with a regex. I know I can use this to find duplicates: self.values('Website')

Re: there was this regex.........

2014-09-16 Thread MikeKJ
scrub this may bad found I was re-writing the error message to "" later on d'oh -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@google

there was this regex.........

2014-09-16 Thread MikeKJ
date_from) #raise NameError(goodmatch) if goodmatch: pass else: date_from_error = "Incorrect input, must be dd/mm/yyy format" goodmatch seems to always be None. I tested the regex at regex101 abd it works with test data like 27/10/2015 date_from

Re: regex error?

2014-05-07 Thread Sergiy Khohlov
try this one url(r'/(?P\d+)$', DetailView.as_view( model = Customer, template_name="customer.html")), Many thanks, Serge +380 636150445 skype: skhohlov -- You received this message because you are subscribed to the Google Groups "Django users

Re: regex error?

2014-05-06 Thread G Z
ive also tried url(r'^customers/([0-9])/$', DetailView.as_view( model = Customer, template_name="customer.html")), -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

regex error?

2014-05-06 Thread G Z
Im using detailview to display customer individualy when the link is clicked on but its not recognizing the number i think my regex is wrong.. this is what i have from django.conf.urls import patterns, include, url from django.views.generic.list import ListView from

Re: [newbie] -- Regex-matching ("Tango with Django")

2014-03-15 Thread Camilo Torres
On Friday, March 14, 2014 8:14:57 PM UTC-4:30, David wrote: > > I am wodering whether my implementation is incorrect or whether there is > a typo in the textbook. My question is how I can make sense of these > instructions: "The regular expression to match about/ is r'^about/'". > > I was follow

Re: [newbie] -- Regex-matching ("Tango with Django")

2014-03-14 Thread Shawn Milochik
You're meant to only have one include that redirects URLs beginning with rango to the app's urls.py. Then, the app's urls.py must not have /rango in the URLs. The idea is that all URLs starting with "rango" get the "rango" stripped off and passed to the rango app, which itself has / and /about. -

[newbie] -- Regex-matching ("Tango with Django")

2014-03-14 Thread David
Dear list, I am wodering whether my implementation is incorrect or whether there is a typo in the textbook. My question is how I can make sense of these instructions: "The regular expression to match about/ is r'^about/'". I was following the "Tango with Django" book. In the exercises of chapter

Re: url tag: "'str' object has no attribute 'regex'"

2013-05-15 Thread quilpy
rk in my situation. I don't know why. >> >> When I try to use the "url" tag in any template an exception is raised: >> "'str' object has no attribute 'regex'" >> >> for example, with this I got the error: >>

Re: url tag: "'str' object has no attribute 'regex'"

2013-04-01 Thread Wenliang Chen
: > > Hello list > > I know, this question has been posted and resolved before, but the > solutions don't work in my situation. I don't know why. > > When I try to use the "url" tag in any template an exception is raised: > "

RE: regex

2013-01-25 Thread Babatunde Akinyanmi
'.' matches any character except a new line Sent from my Windows Phone -- From: arm Sent: 1/25/2013 10:09 AM To: django-users@googlegroups.com Subject: regex Hi, I'm trying to figure out the regular expressions that will match any number and punctu

Re: regex

2013-01-25 Thread Larry Martell
On Fri, Jan 25, 2013 at 2:09 AM, arm wrote: > > Hi, > > I'm trying to figure out the regular expressions that will match any > number and punctuation and chars like +,#,§ etc . Any advice? http://www.regular-expressions.info/charclass.html -- You received this message because you are subscribe

regex

2013-01-25 Thread arm
Hi, I'm trying to figure out the regular expressions that will match any number and punctuation and chars like +,#,§ etc . Any advice? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googleg

Re: only utf-8 letters regex pattern

2013-01-16 Thread Adam Mesha
You can explicitly add the Turkish characters to the character class if there are just a few of them. You could also use the UNICODE regex flag and do something like ur'(?u)^[^\W\d_]+$', which will match any string consisting solely of alphabetic unicode characters. 2013/1/16 arma

Re: only utf-8 letters regex pattern

2013-01-16 Thread Jian Chang
you can use unicode. 2013/1/16 armagan > Turkish chars -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...

only utf-8 letters regex pattern

2013-01-16 Thread armagan
Hi, I'm trying to use regex patterns in django form. I successed in only letters regex pattern. But form controler declines Turkish chars. I think I must use utf-8 regex. Can you help me? name = forms.RegexField(regex =r'^[a-zA-Z]+$') Thanks for help. -- You received this

Re: how to “break” from a regex in urlconf

2012-08-27 Thread Matthew Meyer
Fantastic solution, thank you so much. I will be sure to loose those phrases from my vocab as well :) On Monday, August 27, 2012 3:18:52 AM UTC-4, Melvyn Sopacua wrote: > > On 27-8-2012 4:14, Matthew Meyer wrote: > > > So the question: Is there a way I can keep the fle

Re: how to “break” from a regex in urlconf

2012-08-27 Thread Melvyn Sopacua
On 27-8-2012 4:14, Matthew Meyer wrote: > So the question: Is there a way I can keep the flexible tag regex redirect > behavior but then "break" from it once I reach a product page? One > important thing to note is that I want to keep the product page within the > bu

how to “break” from a regex in urlconf

2012-08-26 Thread Matthew Meyer
(slug=slug) return render(request, 'shop/product_page.html', {'product': product}) along with the following url configurations: url(r'^(?P.+)/$', 'tag_page'), url(r'^(?P.+)/(?P[-\w]+)/$', 'product_page'), The regex that has "tag&quo

Re: Url regex keeps django busy/crashing

2012-08-02 Thread Melvyn Sopacua
On 3-8-2012 2:34, Melvyn Sopacua wrote: Correction: > url(r'^(?P\w[\w-]+-/$', 'detail') insert question mark here --> ? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googl

Re: Url regex keeps django busy/crashing

2012-08-02 Thread Melvyn Sopacua
On 26-7-2012 16:45, Joe wrote: > Hey, I have a url regex like this which is keeping django extremely busy > (20secs to 1min to handle a request). On some urls it even crashes. > > my regex: > > url(r'^(?P(\w+-?)*)/$', 'detail'), Turn the * into a + and yo

Re: Url regex keeps django busy/crashing

2012-07-28 Thread Tim Chase
On 07/26/12 09:45, Joe wrote: > url(r'^(?P(\w+-?)*)/$', 'detail'), > > replaced with: > > url(r'^(?P[\w-]+)/$', 'detail'), Russell gave you good background on the why (including that Django was stung by the same issue). It would help if you more clearly defined what you wanted to target. Your

Re: Url regex keeps django busy/crashing

2012-07-27 Thread Russell Keith-Magee
On Thu, Jul 26, 2012 at 10:45 PM, Joe wrote: > Hey, I have a url regex like this which is keeping django extremely busy > (20secs to 1min to handle a request). On some urls it even crashes. > > my regex: > > url(r'^(?P(\w+-?)*)/$', 'detail'), > > >

Url regex keeps django busy/crashing

2012-07-26 Thread Joe
Hey, I have a url regex like this which is keeping django extremely busy (20secs to 1min to handle a request). On some urls it even crashes. my regex: url(r'^(?P(\w+-?)*)/$', 'detail'), view: def detail(request, item_url): i = get_object_or_404(Page, url=item_url,publi

Re: replace or regex

2012-06-28 Thread Tim Chase
On 06/28/12 01:42, pakyazilim wrote: > i have text ; > ** >A > > B > > > ** > * > * > *i want to remove first end for text end tag. * > *how can i it?* Depends on what you want to happen in various odd edge-cases: - what happens if other tags surround the outside bl

Re: replace or regex

2012-06-28 Thread Kurtis Mullins
You could use regular expressions to parse the string, break it up into chunks and simply remove the first and last chunk (or whatever you're looking for) Also, you could use a DOM Parser to parse this tree and remove the outer-most . Just make sure you don't remove the entire DOM Tree within the U

Re: replace or regex

2012-06-28 Thread Abdulkerim KELEŞ
first is s='** A B **' s.replace('' ,' ', 1 ) but i dont remove last tag. 2012/6/28 pakyazilim > i have text ; > ** >A > > B > > > ** > * > * > *i want to remove first end for text end tag. * > *how can i it?* > *thanks you...* > > -- >

replace or regex

2012-06-27 Thread pakyazilim
i have text ; ** A B ** * * *i want to remove first end for text end tag. * *how can i it?* *thanks you...* -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.goo

url tag: "'str' object has no attribute 'regex'"

2012-05-17 Thread refreegrata
Hello list I know, this question has been posted and resolved before, but the solutions don't work in my situation. I don't know why. When I try to use the "url" tag in any template an exception is raised: "'str' object has no attribute 'regex&#

Re: URL regex not matching

2012-04-24 Thread Swaroop Shankar V
I changed to your regex and it works fine. Thanks a lot :) Thanks and Regards, Swaroop Shankar V On Sun, Apr 22, 2012 at 2:37 PM, yati sagade wrote: > I think that one also matches upto one whitespace character(space, tab or > newline) within the username(The \s). > > > On Su

Re: URL regex not matching

2012-04-22 Thread yati sagade
I think that one also matches upto one whitespace character(space, tab or newline) within the username(The \s). On Sun, Apr 22, 2012 at 2:12 PM, Swaroop Shankar V wrote: > Thanks a lot for your reply. I just found an regex from some blog which is > as follows > > (r'^user/(

Re: URL regex not matching

2012-04-22 Thread Swaroop Shankar V
Thanks a lot for your reply. I just found an regex from some blog which is as follows (r'^user/([\w\'\.\-]+\s?[\w\'\.\-]+)/$','accounts.views.userProfile'), and this seems to be working fine. Have not tested all the use cases for this regex, but anyway username wi

Re: URL regex not matching

2012-04-22 Thread yati sagade
/(\w+)/$','accounts.views.userProfile'), > > this working fine for normal usernames, but if the user add a . (dot) in > between his username the url do not match with the regex and throws Page > not found error. > > Since the django username supports Letters, digi

URL regex not matching

2012-04-22 Thread Swaroop Shankar V
king fine for normal usernames, but if the user add a . (dot) in between his username the url do not match with the regex and throws Page not found error. Since the django username supports Letters, digits and @/./+/-/_ i want all these to be supported in my url. Could someone please help me to c

python, django, regex, θæŋkfəli

2011-11-21 Thread gintare
This is corrected question. The first time it was submitted on 2011.11.22 nd. I am not able to save string with special characters, such as θæŋ after re.search(string). #saving to the model Textfield does not work. Instead of θæŋkfəli, i am getting shown "\xce\xb8\xc3\xa6\xc5\x8bkf\xc9\x99li" in A

Re: Storing regex raw string literal in Django model?

2011-10-14 Thread Daniel Roseman
On Thursday, 13 October 2011 23:58:00 UTC+1, Victor Hooi wrote: > > Hi, > > I have Django model and in one of the fields I need to store a regex string > that I can later use. > > class Foo(models.Model): > name = models.CharField(max_length=30, unique=

Storing regex raw string literal in Django model?

2011-10-13 Thread Victor Hooi
Hi, I have Django model and in one of the fields I need to store a regex string that I can later use. class Foo(models.Model): name = models.CharField(max_length=30, unique=True) regex_string = models.TextField() So for example, the regex_string field might be set to: r'\d{2}

Re: Parenthesis in regex in URLConf

2011-05-23 Thread Pedram
Thanks but I still have problem. My URLConf is like this: Thank you very much. Problem Solved :) On May 23, 1:39 pm, Tom Evans wrote: > On Mon, May 23, 2011 at 10:25 AM, Pedram wrote: > > Hello, > > I have a regular expression for usernames and I want to use this regex > &

Re: Parenthesis in regex in URLConf

2011-05-23 Thread Tom Evans
On Mon, May 23, 2011 at 10:25 AM, Pedram wrote: > Hello, > I have a regular expression for usernames and I want to use this regex > in my URLConf and bind that to a view. The problem is, I have > parenthesis in my regex which should not consider as *args*. Here's my > re

Parenthesis in regex in URLConf

2011-05-23 Thread Pedram
Hello, I have a regular expression for usernames and I want to use this regex in my URLConf and bind that to a view. The problem is, I have parenthesis in my regex which should not consider as *args*. Here's my regex: ^[a-zA-Z0-9]+((\.[a-zA-Z0-9]+)|(_[a-zA-Z-0-9]+))*$ Values in &#x

Re: Transform words into links with regex

2011-04-28 Thread Shawn Milochik
You need to use mark_safe. Otherwise Django will be protecting you from potential malicious input. http://docs.djangoproject.com/en/1.3/ref/utils/#django.utils.safestring.mark_safe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Transform words into links with regex

2011-04-28 Thread martinez
Hello. I am using Django 1.3 on Windows XP. I read a tutorial and the code below transforms the words like MyLink into a html link. But the output that I achieved is the HTML markups of the link, not the link itself. How to solve that? Thank you. wikilink = re.compile("\\b([A-Z][a-z]+[A-Z][a-z]+)\

Re: admin interface and urls.py regex issue

2011-04-03 Thread xiao_haozi
On Apr 3, 11:58 pm, Karen Tracey wrote: > On Sun, Apr 3, 2011 at 11:35 PM, xiao_haozi wrote: > > I'm running into some perplexing regex issues in urls.py and getting > > to my admin section. > > It worked before but now that I have another view added in, anything >

Re: admin interface and urls.py regex issue

2011-04-03 Thread Karen Tracey
On Sun, Apr 3, 2011 at 11:35 PM, xiao_haozi wrote: > I'm running into some perplexing regex issues in urls.py and getting > to my admin section. > It worked before but now that I have another view added in, anything > beyond the index regex is getting fed into the "url/&

admin interface and urls.py regex issue

2011-04-03 Thread xiao_haozi
I'm running into some perplexing regex issues in urls.py and getting to my admin section. It worked before but now that I have another view added in, anything beyond the index regex is getting fed into the "url/" section rather than admin: I've included my urls.py section and

Re: compiled regex as attribute

2011-02-11 Thread Doug Ballance
Have you done any performance testing? From what I understand pythons re.compile caches internally, so after the first call subsequent calls will use the pre-compiled expression. Serializing the compiled expression using pickle isn't 'free', so I'm wondering how much difference there is in practi

Re: compiled regex as attribute

2011-02-11 Thread Javier Guerra Giraldez
On Fri, Feb 11, 2011 at 11:18 AM, Santiago Caracol wrote: > There is no point in storing the regex strings in a pickle field. I > already have the regex strings in ordinary django fields. What I want > to store is *compiled* regular expressions in order to be able to use > them witho

Re: compiled regex as attribute

2011-02-11 Thread Tom Evans
On Fri, Feb 11, 2011 at 4:18 PM, Santiago Caracol wrote: >> Since the pickled value is a string, it should work in fixtures. > > There is no point in storing the regex strings in a pickle field. I > already have the regex strings in ordinary django fields. What I want > to

Re: compiled regex as attribute

2011-02-11 Thread Shawn Milochik
You're forgetting the pickle part. That's what the getter and setter are for in my previous description. import re import pickle pattern = re.compile(r'^\w{3}\s+\d{3}') x = pickle.dumps(pattern) type(x) If you store 'x' in your database you won't have any difficulty with fixtures. Shawn --

Re: compiled regex as attribute

2011-02-11 Thread Santiago Caracol
> Since the pickled value is a string, it should work in fixtures. There is no point in storing the regex strings in a pickle field. I already have the regex strings in ordinary django fields. What I want to store is *compiled* regular expressions in order to be able to use them without having

Re: compiled regex as attribute

2011-02-11 Thread Shawn Milochik
The picklefield stores strings. So when you say "regexes can't be stored in fixtures," it implies that you're dealing with something other than strings at that point. Have you tried the pickle field? As I understand it, it's equivalent to this manual process: Create a normal text field.

Re: compiled regex as attribute

2011-02-11 Thread Santiago Caracol
> http://pypi.python.org/pypi/django-picklefield/0.1 Thanks for the tip. This works, but it has one great disadvantage: The regexes can't be stored in fixtures. They are stored in the database directly. So it seems I would have to insert all my several thousand products manually again. And if I ch

Re: compiled regex as attribute

2011-02-11 Thread Tom Evans
and > store the regular expression only once: at the time when the new > product is saved. > > However, there doesn't seem to be a models.RegexField. There is a > forms.RegexField, but I don't understand how I could use it in the > product model. > > Any tips how to s

compiled regex as attribute

2011-02-11 Thread Santiago Caracol
could use it in the product model. Any tips how to store the compiled regex? Santiago -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this grou

Re: Regex problem in urls

2010-07-30 Thread Alex Robbins
sing the URLconf defined in sunlight.urls, Django tried these URL > patterns, in this order: > >    1. ^admin/doc/ >    2. ^admin/(.*) >    3. ^[/]$ >    4. req/ > > The current URL, start/, didn't match any of these. > > So it looks like it isn't properly

Regex problem in urls

2010-07-29 Thread Gordy
d (404) Request Method: GET Request URL:http://server2/start/ Using the URLconf defined in sunlight.urls, Django tried these URL patterns, in this order: 1. ^admin/doc/ 2. ^admin/(.*) 3. ^[/]$ 4. req/ The current URL, start/, didn't match any of these. So it looks like

Re: URLs and Regex Question for passing email address?

2010-02-15 Thread Karen Tracey
s%40cdu.edu.au/ > > I don't care about whether this is a valid email string I simple want > to pass the parameter across to the view and do the look up here. > > I notice the @ is already %40 which has been escaped by the Javascript > in the calling application. > > In

Re: URLs and Regex Question for passing email address?

2010-02-15 Thread Shawn Milochik
It sounds like this might be a good case for a GET (querystring). As in: http://localhost:8000/contact/?email=ronald.ninnis%40cdu.edu.au/ Then use something like request.GET.get('email', '') to get the value. That seems easier and cleaner than trying to have a URL patter

URLs and Regex Question for passing email address?

2010-02-15 Thread Jonathan Sutcliffe
this is a valid email string I simple want to pass the parameter across to the view and do the look up here. I notice the @ is already %40 which has been escaped by the Javascript in the calling application. In my urls.py I have the following regex. urls.py (r'^contact/(?P\[a-z0-9._%+.

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-12 Thread Tom Evans
On Fri, 2009-10-09 at 12:21 -0700, davisd wrote: > Sorry for the public disclosure... I did email django security after > I posted. I'm just getting into this open source goodness and I'm not > really sure how it's supposed to operate yet. > > I did consult the documentation: > http://docs.dja

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Jacob Kaplan-Moss
Just as an update for anyone following this thread: This was indeed a security exploit, and it has been fixed. See http://www.djangoproject.com/weblog/2009/oct/09/security/ for details. Jacob --~--~-~--~~~---~--~~ You received this message because you are subscri

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Karen Tracey
On Fri, Oct 9, 2009 at 3:21 PM, davisd wrote: > > I'm wondering if a multithreaded webserver setup would be more guarded > against this sort of thing? > > Yeah, but. When I tried this on my own production server (Apache/mod_wsgi) the process handling the request that caused the problem was kille

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread davisd
Sorry for the public disclosure... I did email django security after I posted. I'm just getting into this open source goodness and I'm not really sure how it's supposed to operate yet. I did consult the documentation: http://docs.djangoproject.com/en/dev/internals/contributing/ Jacob: I'm run

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread James Bennett
Yes. We've confirmed the problem. We're working on a patch. In the meantime, everybody go meditate on the documentation for how to report security issues. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ Yo

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Juan Hernandez
Take a look at mine: *In [41]: from django.forms.fields django.forms.fields In [41]: from django.forms.fields import email_re In [42]: email_re.match('viewx3dtextx26q...@yahoo.comx26latlngx3d15854521645943074058 ')* and this is what top shows: * PID USER PR NI VIRT RES SHR S %CPU %ME

Re: regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread davisd
ail_re.match > ('viewx3dtextx26q...@yahoo.comx26latlngx3d15854521645943074058') > > will cause CPU to shoot up 100% and the process will hang forever. > > Since this is the regex used to validate EmailField on forms, won't > this DOS a live site? > > Where should I report t

regex infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread davisd
After hours of debugging, I found that: from django.forms.fields import email_re email_re.match ('viewx3dtextx26q...@yahoo.comx26latlngx3d15854521645943074058') will cause CPU to shoot up 100% and the process will hang forever. Since this is the regex used to validate EmailFiel

Re: Q regex

2009-10-06 Thread Tim Chase
Karen Tracey wrote: > On Tue, Oct 6, 2009 at 1:32 PM, Mat wrote: > >> Okay so here is my code: >> >> **This way works and does not error** >> rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); >> print len(rs); >> print rs[0].addr >> >> ***This way errors

Re: Q regex

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 1:32 PM, Mat wrote: > > Okay so here is my code: > > **This way works and does not error** > rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); > print len(rs); > print rs[0].addr > > ***This way errors > q = Q({'addr__iregex':'^(192\

Q regex

2009-10-06 Thread Mat
Okay so here is my code: **This way works and does not error** rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); print len(rs); print rs[0].addr ***This way errors q = Q({'addr__iregex':'^(192\.188\.)(.*)(\.20)$'}); rs = BadActor.objects.filter(q); print

Re: regex query delivering incorrect results

2009-09-29 Thread janedenone
Hi Karen, On 28 Sep., 22:49, Karen Tracey wrote: > On Mon, Sep 28, 2009 at 4:00 PM, janedenone wrote: > > > Hi, > > > this > > > pages = Page.objects.exclude(content__iregex=r'^[\n\r \t]*<') > > > should deliver the same rows as this > > > SELECT ... FROM pages WHERE (content NOT REGEXP '^[\n\r

Re: regex query delivering incorrect results

2009-09-28 Thread Karen Tracey
On Mon, Sep 28, 2009 at 4:00 PM, janedenone wrote: > > Hi, > > this > > pages = Page.objects.exclude(content__iregex=r'^[\n\r \t]*<') > > should deliver the same rows as this > > SELECT ... FROM pages WHERE (content NOT REGEXP '^[\n\r \t]*<') > > but it does not: The Django query delivers 468 rows

regex query delivering incorrect results

2009-09-28 Thread janedenone
Hi, this pages = Page.objects.exclude(content__iregex=r'^[\n\r \t]*<') should deliver the same rows as this SELECT ... FROM pages WHERE (content NOT REGEXP '^[\n\r \t]*<') but it does not: The Django query delivers 468 rows, whereas the SQL query delivers 223. It could be that the Django quer

Unicode [i]regex + sqlite3

2009-09-08 Thread matevzb
I've run into a strange problem using Django's [i]regex search with non-ascii characters. I'm using the [i]regex in the following manner: begin code class Tag(models.Model): def __unicode__(self): return self.keyword keyword = models.CharField(max_len

Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-06 Thread Jim Myers
My noob error: I had extra "portal/" on my regex. Sorry and thanks for your attention. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Graham Dumpleton
On Sep 6, 3:52 pm, Karen Tracey wrote: > On Sun, Sep 6, 2009 at 1:36 AM, Jim Myers wrote: > > > Thanks, but that doesn't do it either. > > I changed the regex to: > > > ^portal/student/(?P\S+)/profile_edit/$ > > > and it still doesn't match :( >

Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Karen Tracey
On Sun, Sep 6, 2009 at 1:36 AM, Jim Myers wrote: > > Thanks, but that doesn't do it either. > I changed the regex to: > > ^portal/student/(?P\S+)/profile_edit/$ > > and it still doesn't match :( > > It should: >>> import re >>> re.match(r&#

Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Jim Myers
Thanks, but that doesn't do it either. I changed the regex to: ^portal/student/(?P\S+)/profile_edit/$ and it still doesn't match :( On Sep 5, 9:44 pm, Karen Tracey wrote: > On Sat, Sep 5, 2009 at 11:32 PM, Jim Myers wrote: > > > Hi, I'm using this regex in urls.

Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Karen Tracey
On Sat, Sep 5, 2009 at 11:32 PM, Jim Myers wrote: > > Hi, I'm using this regex in urls.py: > > r'^portal/student/(?P\S+)/profile_edit$' > > There's no trailing slash on this regex, but there is an end of string marker ($). So a match will have to end

regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Jim Myers
Hi, I'm using this regex in urls.py: r'^portal/student/(?P\S+)/profile_edit$' to try to match this url: http://dd..org/portal/student/xx.yy/profile_edit/ It's supposed to put "xx.yy" into userid parameter and match and use the associated view. But it does

Re: regex problem in django

2009-06-29 Thread James Gregory
On Jun 29, 2:57 pm, Joru wrote: > Still doesn't work even I remove wrap function :( So it seems your regex is incorrect, the problem is not related to Django. If you paste your code here I can have a look, but I still think you'd be better off reading a bit more about regula

  1   2   3   >