Re: segmentation fault while running test suite and possible bug in documentation.

2017-05-19 Thread Zach
Vimarsh, you correctly used the word. "Guys" may be used to refer to 
members of a group regardless of sex.

Source: https://www.merriam-webster.com/dictionary/guys

On Thursday, December 1, 2016 at 2:40:00 AM UTC-8, Vimarsh Chaturvedi wrote:
>
> Hey Josh, 
>
> Thanks for the response. 
>
>
> Hey Aymeric, 
> Apologies. Won't happen again. Didn't realise what I was typing. Where I'm 
> from "guys" just refers to everyone. 
> Regardless. Apologies. 
>
> Thanks
>
> On Thursday, December 1, 2016 at 3:51:16 PM UTC+5:30, Aymeric Augustin 
> wrote:
>>
>> Hey Vimarsh,
>>
>> Since Django contains no C code, a segmentation fault usually indicates a 
>> bug in Python.
>>
>> Did you search https://code.djangoproject.com/ for similar issues? This 
>> error happened on some versions of a popular OS distribution, although it 
>> hasn’t been reported in the last few months.
>>
>> If you can’t find anything, please report your OS / Python / sqlite 
>> versions.
>>
>> Thanks,
>>
>> -- 
>> Aymeric.
>>
>> PS - I’d love it if you said hello to everyone on this mailing list, and 
>> not just men. Try “hey folks” next time?
>>
>> On 1 Dec 2016, at 09:00, Vimarsh Chaturvedi  wrote:
>>
>> Hey guys, 
>>
>> My first time posting here. 
>> I downloaded the Django source code and I was going through the 
>> instructions given in "Writing your first patch for Django" 
>> 
>> .
>> I am working with Python 2. So, I installed packages via the py2.txt in 
>> the requirements directory. 
>>
>> So, first with the possible bug. 
>> So, the documentation says, after your done with the installation run: 
>>
>> ./runtests.py 
>>
>> which gave me the following error:
>> *ImportError: No module named django*
>>
>> The README inside the tests directory says to run: 
>>
>> PYTHONPATH=..:$PYTHONPATH ./runtests.py
>>
>> This command didn't give any error and the tests started running. 
>> So, Is this a bug in the documentation, or is there something I'm 
>> missing? 
>>
>> Moving on to the segmentation. 
>> I run the test suite thrice. The first time it gave a seg fault w/o 
>> running any tests the other two times it gave the same error after running 
>> about 3k - 4k tests. 
>> The exact error is: 
>>
>> *16858 segmentation fault   PYTHONPATH=..:$PYTHONPATH ./runtests.py*
>>
>> Can any one help with this? 
>> Is this because I'm running Python 2.x and not Python 3? 
>>
>>
>> Thanks
>>
>>
>> -- 
>> 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-d...@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/d164b3ba-d089-401d-9d92-00667e6e48d6%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/bd030d7d-b31a-463e-99c2-6ee6ff9098f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Link to 'create page' when not in Edit mode.

2017-05-19 Thread Richard Prosser
I want to display a link such that when a user clicks on it, a 'Create 
Page' wizard is invoked, enabling the user to add some content to a new 
page, then save it. However that should not require Edit mode, ideally.

I know about the 'create_page' API but I do not see how to invoke that for 
normal user, even if s/he is a member of a group with the appropriate 
permissions. I also want to use a link rather than a menu entry.

The docs do not seem to address this issue, so does anyone here know how to 
do this, please?


Thanks ...

Richard

-- 
Message URL: 
https://groups.google.com/d/msg/django-cms-developers/topic-id/message-id
Unsubscribe: send a message to 
django-cms-developers+unsubscr...@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"django CMS developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-cms-developers+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/django-cms-developers/d7f846bd-a8ab-454d-826e-05e0cb51902b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Are there use cases for storing null bytes in CharField/TextField?

2017-05-19 Thread Tim Graham
If CharField/TextField have a form validation error if null bytes are in 
the input, are users going to be able to understand that error and fix it? 
I'm not sure if it's a probable case, but I'm thinking of a non-technical 
user who copy/pastes some text that includes a null byte.

Perhaps a " strip_null_bytes" model field option that defaults to True 
would be reasonable. That could be passed to the form field to toggle where 
or not that validation happens. Actually, three possible behaviors might be 
needed: silently strip null bytes, allow null bytes (an invalid option when 
using PostgreSQL), prohibit null bytes.

On Tuesday, May 16, 2017 at 5:11:38 AM UTC-4, Jani Tiainen wrote:
>
> Hi,
>
> I would guess that one could use null byte to denote "empty field" in 
> Oracle for example. (I recall seeing such a convention in one of our 
> non-django apps). And that's to overcome limitation that Oracle doesn't 
> have real concept of empty string so we stored single null byte to mark 
> that. 
>
>
> On 15.05.2017 18:54, Tim Graham wrote:
>
> Does anyone know of a use case for using null bytes in CharField/TextField?
>
> psycopg2 2.7+ raises ValueError("A string literal cannot contain NUL 
> (0x00) characters.") when trying to save null bytes [0] and this 
> exception is unhandled in Django which allow malicious form submissions to 
> crash [1]. With psycopg2 < 2.7, there is no exception and null bytes are 
> silently truncated by PostgreSQL. Other databases that I tested (SQLite, 
> MySQL, Oracle) allow saving null bytes. This creates possible 
> cross-database compatibility problems when moving data from those databases 
> to PostgreSQL, e.g.[2].
>
> I propose to have CharField and TextField strip null bytes from the value 
> either a) only on PostgreSQL or b) on all databases. Please indicate your 
> preference or suggest another solution.
>
> [0] https://github.com/psycopg/psycopg2/issues/420
> [1] https://code.djangoproject.com/ticket/28201 - Saving a Char/TextField 
> with psycopg2 2.7+ raises ValueError: A string literal cannot contain NUL 
> (0x00) characters is unhandled
> [2] https://code.djangoproject.com/ticket/28117 - loaddata raises 
> ValueError with psycopg2 backend when data contains null bytes
> -- 
> 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-develop...@googlegroups.com .
> To post to this group, send email to django-d...@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/9897126d-b6ef-48f1-9f19-96ed98ce10e5%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
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/7226ab56-ff69-415c-9955-82e8d62cdd60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: two question, common template and mutiple user type

2017-05-19 Thread Tim Graham
Please don't post questions like this (about using Django) to this list 
(its topic is about developing Django). Use the django-users or the #django 
IRC channel list for that. 

On Thursday, May 18, 2017 at 6:58:59 AM UTC-4, Man Single wrote:
>
> Two question: 
> First: There are multiple type user, for example: NormalUser, StaffUser, 
> EnterpriseUser, the model like this:
> class User(AbstractBaseUser):
> # some auth related field here
>
>
> class NormalUser(User):
> # extend , not abstract
>
>
> class StaffUser(User):
>
>
> class EnterpriseUser(User):
>
>
> class AdminUser(User):
>
> my solution:
> But EnterpriseUser, can create childuser, so enterprise_user have two 
> type. there is one way add one user_type field to User model, represent 
> what type the user is, or according the 
> user relationship determine what the user type is: normaluser, 
> enterpriseuser, enterprise_child_user, admin.
>
> Second: There are two user background manager page, one for staff to 
> manage order, enterprise. one for normaluser to manage themself order. So 
> there are two url path: /staff_bg/  /user_bg/
> But they are use the same base template, the only different is the header 
> tab is not same. For example:
>
> user_header.html
> {% extends "core/base.html" %}
> 
> 
> your orders
> 
> 
>
> staff_header.html
> {% extends "core/base.html" %}
> 
> 
> enterprise
> 
> 
>
> then:
> user_realted.html:
> {% extends "core/user_header.html" %}  # focus here
> {% block body %} 
> # something
> {% endblock %}
>
> then:
> staff_related.html
> {% extends "core/staff_header.html" %} # focus here
> {% block body %} 
> # something
> {% endblock %}
>
> my solution:
> create core/middle.html:
> {% extends the_template_name %}
>
> then 
> user_realted.html:
> {% extends "core/middle.html" %}  # focus here
> {% block body %} 
> # something
> {% endblock %}
>
> One way write custom template processor, base one request.path pass 
> different the_template_name( "cms/user_header.html" or 
> "core/staff_header.html" ) to middle.html, but I think it's dirty,
> and if code wrong, maybe normal user can see the staff tabs.
>
> another way: 
> pass different the_template_name to middle.html, in every view. of course, 
> it will change every view that already wrote.
>

-- 
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/2d6737c0-d582-4509-b810-592b1e822291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.