Re: A proposal for a new auto-reloader in Django

2017-04-02 Thread Carl Meyer
Hi David,

I wouldn't bother with the wsgiwatcher repo; it's proof-of-concept code
from one sprint's worth of hacking, not used by anyone. Look at hupper
instead, it is based on wsgiwatcher, but much changed, and actually used
in production.

Carl

On 04/02/2017 04:27 PM, qingnian...@gmail.com wrote:
> Hi Carl,
>   I don't quite understand why get_module_paths() in your wsgiwatcher
> project is returning a list of python module paths. I thought it would
> return the directory that needs to be monitored. Could you please tell
> me how this part works? Thanks.
> 
> David Ma
> 
> On Thursday, March 30, 2017 at 7:47:13 AM UTC-7, Carl Meyer wrote:
> 
> Anyone working on this project should at least be aware of
> https://github.com/Pylons/hupper 
> (based on work David Glick and I
> originally did in https://github.com/carljm/wsgiwatcher
> ), which aims to
> be a framework-agnostic solution to this problem for any Python web
> project. Docs at
> http://docs.pylonsproject.org/projects/hupper/en/latest/
> 
> 
> 
> 
> Carl
> 
> -- 
> 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 django-developers+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-developers@googlegroups.com
> .
> 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/4fac9a8a-231d-41c5-a5fb-6eaeb2bd148f%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/99fbed1c-3ac4-64b9-5030-3d5e2533cef4%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: A proposal for a new auto-reloader in Django

2017-04-02 Thread qingnian213
Hi Aymeric,
  I feel like using Watchman might be the easiest solution. It keeps 
triggering the command once an event occurs, so autoreload.py does not need 
to restart the server in case of a syntax error. Pywatchman does not work 
on Python 3 and has some dependency problems, so I'm planning to use the 
command line interface of the Watchman library. Watchdog only triggers the 
given command once, so it cannot survive a syntax error and requires the 
auto-reloader to deal with multi-threading, the most challenging part in 
this project (likely to enter the same problem described in #2330 
.) Therefore, I'd start with 
Watchman and see how to implement this with Watchdog later. How do you feel 
about this plan? 

Cheers,
David Ma

On Sunday, April 2, 2017 at 6:33:38 AM UTC-7, Aymeric Augustin wrote:
>
> Hello,
>
> On 1 Apr 2017, at 05:52, qingn...@gmail.com  wrote:
>
> For the pure-Python solution, I might implement a standalone autoreloader 
> based on Carl's work and replace the current one. Does this look good to 
> you?
>
>
> Perhaps.
>
> It depends on the details (features, installation requirements, cross 
> platform support, etc.).
>
> It's up to you to argument in your proposal why this would be a good 
> solution.
>
> Best regards,
>
> -- 
> Aymeric.
>
>
>
>

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/3c284301-15e9-44d9-9b7c-2d866b7f7d13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A proposal for a new auto-reloader in Django

2017-04-02 Thread qingnian213
Hi Carl,
  I don't quite understand why get_module_paths() in your wsgiwatcher 
project is returning a list of python module paths. I thought it would 
return the directory that needs to be monitored. Could you please tell me 
how this part works? Thanks.

David Ma

On Thursday, March 30, 2017 at 7:47:13 AM UTC-7, Carl Meyer wrote:
>
> Anyone working on this project should at least be aware of 
> https://github.com/Pylons/hupper (based on work David Glick and I 
> originally did in https://github.com/carljm/wsgiwatcher), which aims to 
> be a framework-agnostic solution to this problem for any Python web 
> project. Docs at http://docs.pylonsproject.org/projects/hupper/en/latest/ 
> 
>  
>
> Carl 
>
>

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/4fac9a8a-231d-41c5-a5fb-6eaeb2bd148f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Proposal: make Model __unicode__() default to self.name

2017-04-02 Thread Collin Anderson
Makes sense to me. Maybe still keep the "Transaction object" part, and use
None if no pk.

On Sun, Apr 2, 2017 at 11:09 AM, Kapil Garg  wrote:

> Ticket 27953  is regarding
> this proposal and the suggestion is about adding "pk" in Model string
> representation if it exists.
>
> On Thursday, 11 July 2013 09:16:25 UTC+5:30, Collin Anderson wrote:
>>
>> Hi All,
>>
>> Have you ever quickly set up a model, ran syncdb, and added a few sample
>> objects in the admin to only see a bunch of "MyModel object"s in the
>> changelist? I always forget to add a __unicode__()/__str__() method on my
>> models.
>>
>> I ran "git grep -1 __unicode__" on some of my django projects and noticed
>> a lot of repeated code. In fact, it seems that in about a _third_ of all my
>> cases, I'm just returning self.name, or returning self.name would have
>> been a good default. I looked at a few 3rd party apps for comparison and
>> found similar results, though not for every app.
>>
>> IMHO, returning self.name (if the field or property exists) is a
>> sensible default for __unicode__. We can still return "MyModel object" if
>> there's no "name" attribute. You'll still end up adding your own
>> __unicode__ method much of the time, just like you always have.
>>
>> Yes, it's "magic", but we can document it.
>> Yes, it's a little more confusing, but we don't have to explain it during
>> the tutorial.
>> Yes, it's backwards incompatible, but only in rare cases should it be a
>> problem.
>> Yes, it could look like any Model without a "name" field is "wrong", but
>> it's not.
>> Yes, "title" is also very popular, but name is better. :)
>>
>> It has the effect of being a little more friendly in many cases, and can
>> result in more DRY code.
>>
>> What do your __unicode__/__str__ methods look like? Is this a bad idea?
>>
>> Thanks,
>> Collin
>>
>> --
> 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 django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> 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/c7254a96-7ee3-4262-a90b-
> 83dcfe8fa3d4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/CAFO84S46Vg_A%3Dab0GSo%3D4RkmUK85%3D%2BcNb8C6WMDB%2BcpZrt9XVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Vietnamese Django full text search in postgres.

2017-04-02 Thread Cử Nhữ Văn
Hi Django developers!
I'm newbie in django. I have a problem with Vietnamses full text search in 
postgres DB. Please help me!
I have a website supported English and Vietnamese. When I search with 
English, everything ok. When I search with Vietnamese, I got problem:
When i inputed "gia" it only return result of "gia". But I need result 
include "gia, giá, giả, già".
I got nothing when i search on google. Does Django support this? and how 
can i implement?
Thank you so much!

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/4b69805b-376b-4c55-ae25-ed05ecb83547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Proposal: make Model __unicode__() default to self.name

2017-04-02 Thread Kapil Garg
Ticket 27953  is regarding 
this proposal and the suggestion is about adding "pk" in Model string 
representation if it exists. 

On Thursday, 11 July 2013 09:16:25 UTC+5:30, Collin Anderson wrote:
>
> Hi All,
>
> Have you ever quickly set up a model, ran syncdb, and added a few sample 
> objects in the admin to only see a bunch of "MyModel object"s in the 
> changelist? I always forget to add a __unicode__()/__str__() method on my 
> models.
>
> I ran "git grep -1 __unicode__" on some of my django projects and noticed 
> a lot of repeated code. In fact, it seems that in about a _third_ of all my 
> cases, I'm just returning self.name, or returning self.name would have 
> been a good default. I looked at a few 3rd party apps for comparison and 
> found similar results, though not for every app.
>
> IMHO, returning self.name (if the field or property exists) is a sensible 
> default for __unicode__. We can still return "MyModel object" if there's no 
> "name" attribute. You'll still end up adding your own __unicode__ method 
> much of the time, just like you always have.
>
> Yes, it's "magic", but we can document it.
> Yes, it's a little more confusing, but we don't have to explain it during 
> the tutorial.
> Yes, it's backwards incompatible, but only in rare cases should it be a 
> problem.
> Yes, it could look like any Model without a "name" field is "wrong", but 
> it's not.
> Yes, "title" is also very popular, but name is better. :)
>
> It has the effect of being a little more friendly in many cases, and can 
> result in more DRY code.
>
> What do your __unicode__/__str__ methods look like? Is this a bad idea?
>
> Thanks,
> Collin
>
>

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/c7254a96-7ee3-4262-a90b-83dcfe8fa3d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A proposal for a new auto-reloader in Django

2017-04-02 Thread Aymeric Augustin
Hello,

On 1 Apr 2017, at 05:52, qingnian...@gmail.com wrote:

> For the pure-Python solution, I might implement a standalone autoreloader 
> based on Carl's work and replace the current one. Does this look good to you?


Perhaps.

It depends on the details (features, installation requirements, cross platform 
support, etc.).

It's up to you to argument in your proposal why this would be a good solution.

Best regards,

-- 
Aymeric.



-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/C906C8DA-32D9-48A7-B1BB-6693B0F0C672%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.