Hedde van der Heide | 23 May 13:02
Picon
Gravatar

Suggestion: make auth login view more dynamic

I couldn't find an existing ticket but I'd like to suggest a change to make the basic auth view more dynamic (I'm not fond of hardcoded context variables :-))

change:

def login(request, template_name='registration/login.html',
          redirect_field_name=REDIRECT_FIELD_NAME,
          authentication_form=AuthenticationForm,
          current_app=None, extra_context=None):

to:

def login(request, template_name='registration/login.html',
          redirect_field_name=REDIRECT_FIELD_NAME,
          authentication_form=AuthenticationForm,
          current_app=None, extra_context=None, form_name='form'):


and obviously:

    context = {
        form_name: form,
        redirect_field_name: redirect_to,
        'site': current_site,
        'site_name': current_site.name,
    }


Kind Regards,

Hedde van der Heide

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to django-developers+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Jeremy Dunck | 22 May 21:30
Picon
Gravatar

Announcement: twice-monthly Django sprints in San Francisco

My company, Votizen, now has an office in San Francisco, just a block
from the 4th St Caltrain station.  We have room to host sprints -
easily 25 people, though we can grow if there is demand.  We have a
professional kitchen, great coffee gear, and maybe a kegerator soon.
There are many great places to eat within an easy walk.

We will begin hosting day-long, twice-monthly sprints for Django on
the 1st and 3rd Saturdays of each month.  We hope that by making it a
comfortable length and a regular occurrence, we can grow a good core
of contribution.

Note: this first sprint will be on Sunday, June 3rd due to a prior
commitment - sorry about that. :-)

Since we need to manage space and setup demands in order to make this
a regular event, we'll use eventbrite for free tickets.

If your company would like to sponsor food & beverage on a per-event
basis, that would be appreciated.  Please contact me off-list for
logistics.

So, if you are in the bay area and would like to contribute,
collaborate, mentor or be mentored, you are invited to attend - please
sign up:
  http://sfdjangosprint.eventbrite.com/

--

-- 
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

James Pic | 22 May 11:53
Picon
Gravatar

ModelForm enforces its version of save_m2m

Hello everybody,

Currently, Django ModelForm enforces it's local version of save_m2m:
https://github.com/django/django/blob/38408f8007eae21b9f1cbbcc7f86d4b2042ff86a/django/forms/models.py#L76

As a result, users who want to overload save_m2m can not support
commit=False: https://github.com/yourlabs/django-autocomplete-light/blob/master/autocomplete_light/contrib/generic_m2m.py#L50

Wouldn't it be great if users could overload save_m2m ?

If you agree, I volunteer to do the ticket and pull request. Else I'll
leave my hack in my app :(

Regards

--

-- 
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

Michael Lissner | 20 May 08:24
Gravatar

Sitemaps files using the X-Robots-Tag HTTP header

I just created ticket 18351, which is to add the X-Robots-Tag HTTP header to our default sitemaps.

The reason for this is somewhat complicated, and I've explained it in the ticket, but basically, the goal is to make it so sitemaps don't appear in search results anymore (though of course, you want their urls to continue appearing). Currently we don't set any special headers on our sitemaps, and as a result, you can find sitemaps within search results.

If you so desire, you can prove this with clever queries like: [ sitemap.xml site:yourdjangosite.com ]

I've put a patch on the bug that adds:

response['X-Robots-Tag'] = 'noindex, noodp, noarchive, noimageindex'

To all sitemap files. I haven't added this to the documentation, since it seems like an implementation detail. I've run the tests, and I hope I'm good to have the patch landed.

Would appreciate any feedback though, since it's my first patch to Django.

Mike

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/mYi1YLoXPWMJ.
To post to this group, send email to django-developers-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to django-developers+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Will Hardy | 19 May 15:46
Picon

Re: Djangopeople.net status

Seeing as we have to deal with a stale data issue anyway, I thought I
would throw an idea into the mix.

I think it'd be nice to have something where the data is a little more
open, allowing anyone to create an index of developers. For example,
each developer who wants to be index sticks a json file somewhere
online with loosely standard information: who they are, whether or not
they are currently available, where they are happy to work, what their
relevant interests are, some experience and links to
github/twitter/etc accounts.

This way, a developer would need only update the file and the changes
would propagate to whatever index others have built. For employers, it
means the index only contains people clever enough to put a json file
on their website/github/etc :-)

There are of course no doubt issues with this (verification etc), but
I thought I would mention a worthy goal. At the very least,
people.djangoproject.com could provide a simple API, in effect hosting
such information and letting others build fancy indicies. As someone
who is looking for competent developers, I'd be happy to work on this
if others find it useful.

Cheers,

Will

--

-- 
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

Tom Evans | 18 May 16:29

Re: Possible session key creation regression in 1.4

On Fri, May 18, 2012 at 1:38 PM, Aymeric Augustin
<aymeric.augustin.2003@...> wrote:
> Le 18 mai 2012 à 11:51, Tom Evans <tevans.uk@...> a écrit :
>
>> On Wed, May 16, 2012 at 4:38 PM, Aymeric Augustin
>> <aymeric.augustin@...> wrote:
>>> 2012/5/16 Tom Evans <tevans.uk@...>:
>>>> So, is the session key being available part of the API, or is relying
>>>> on the session key existing incorrect?
>>>
>>> Hi Tom,
>>>
>>> Accessing the session key before saving the session is incorrect.
>>>
>>
>> Accessing the session key before saving the session is incorrect, but
>> there is nothing in the session API to determine if a session is
>> saved.
>
> if session.session_key == None:
>    ...
>
>> I don't see a good way to support 1.3 and 1.4 or in 1.3 to work around the bug that this fixes
>
> If I understand correctly, you're writing a pluggable app and you want to make it compatible with Django
1.3 and 1.4.
>
> You didn't know this bug existed in 1.3, so I don't understand your sudden urge to work around it in your
application. Just keep your current code as is and if your users complain, show them that it's a bug in
Django and tell them that they should upgrade.

That may be fine for open source code, it's not appropriate here. I
need to support my features in Django 1.2 and upwards. We have seen
strange things where the session id that we extract is not correct,
and this bug, which I was not aware of, explains that issue. Therefore
I do need to work around it, now that I am aware of it.

Saying to my users, "oh, and now I don't support the version of Django
you use any more, drop all your other projects and upgrade now" is not
acceptable.

>
>> without explicitly saving the session
>> object each time prior to accessing the session key, which is not a
>> particularly clever way of doing things. This API needs to be looked at.
>
> The following sounds perfectly simple and reasonable to me:
>
> if session.session_key == None:
>    session.save()
>
> The if clause will match only under Django 1.4, since under 1.3 session_key isn't None when it should. So
you support automatically both versions.

Grrr - session_key should never be None. This should be part of the
explicit contract of the session API - if I'm looking at the
session_key, I want to know what is OR WILL BE the session id. If the
session needs to be saved in order to generate the key, it should be
saved by the backend.

Or to put it another way; my code is never interested in a None
session_key. A valid session never has a key of None. Therefore I now
have to put code in to explicitly ensure that I have a valid
session_key

The bug that was fixed was that accessing session_key before the
session was saved could potentially give you a different session_key
than the one which eventually ends up being used. The fix was to make
the session_key property return None when unsaved - changing the API -
rather than at that point determining what session_key should be used,
which would have kept the same API.

Due to the API changing, and Django not merging bug fixes back through
branches, I now know that I have an issue with 1.3 and below clients
that must be accounted for, and that I must ensure the session is
saved before accessing it, as this ensures in both 1.3 and 1.4 that
the session.session_key is the key for the users session.

This means that each and every place I access session_key in code that
must work in 1.3 and 1.4, I must put in place code like this:

  # We cannot access session.session_key before the session is saved
  # Django provides no way of determining if the session has been saved
  # so we must always save it here. However, there is a race in the
  # session creation that may cause it to fail on key collision.
  while True:
    try:
      request.session.save()
    except IntegrityError:
      # In <=1.4, session.save() does not generate a new session key
      # if it conflicts, therefore we must do it for Django.
      if django.VERSION[0] < 2 and django.VERSION[1] < 5:
        # There is no API to request a new session key without churning
        # the session. Use internal API.
        request.session._session_key = request.session._get_new_session_key()
      continue
    else:
      break
  session_identifier = SSOIdentifier(identifier=request.session.session_key)

Yeah, that API totally rocks. Totally better than determining what the
session_key is when someone wants to know what the session_key is and
we haven't saved the session yet.

>
> I'm sorry, but it's hard to read your criticism in a constructive way when the solution is obvious and
doesn't need any changes in Django's APIs.
>
> You raised several related points in your next email; could you create tickets on Trac so we can verify and
fix these issues?
>
> Thanks!

It was only one point. Ticket 18344.

Cheers

Tom

--

-- 
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

Y. | 18 May 09:49
Picon

DJango 1.3 - BundleError while rendering

Hi, I'm new to Django and trying to get an existing application to work on my development machine.


When running the project, I get the following error:

TemplateSyntaxError at /

Caught BundleError while rendering: 'styles/libs/jquery-ui-timepicker-addon.css' not found (using staticfiles finders)
 Where is he searching for the file? All paths are set correctly in settings.py. 
The css is defined in assets.py:

stylesheets = Bundle( reset_defaults,
    'styles/libs/jquery-ui-timepicker-addon.css',
    main_styles,
    filters='cssmin',
    output='combined/styles/main.css' )


Can anyone give me an indication of where to search for this problem?
Any help would be greatly appreciated

Kind
regards
Y.

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/o_FFt0BkqlAJ.
To post to this group, send email to django-developers-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to django-developers+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
James Rivett-Carnac | 18 May 08:03
Picon

Localflavor Test Case issues

Hey,


I'm trying to add localflavor for Singapore, and am running into issues getting my test cases to pass.

When manually validate my test cases by running the validators from the django-admin shell, they pass all my test cases.  But when I run my test cases from the test runner, I get:

AssertionError: ValidationError not raised

and the test case test_postcode seems to be adding another invalid test, None:[u'This field is required.'], but I might be confused by this.

Any help in what I'm doing wrong would be appreciated.

My code is at 
git-9UaJU3cA/F/QT0dZR+AlfA@public.gmane.org:yarbelk/django.git

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/w91JYlJaD1MJ.
To post to this group, send email to django-developers-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to django-developers+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Anssi Kääriäinen | 18 May 10:43
Picon

Django git guidelines

A heads up: I am working on Git and Github usage guidelines. There is
a ticket https://code.djangoproject.com/ticket/18307, and I have a
github branch with some initial work https://github.com/akaariai/django/tree/django_git_guidelines
(or for changeset https://github.com/akaariai/django/compare/django_git_guidelines)

The guidelines in short:
 - For trivial patches use pull requests directly
 - For non-trivial patches, create a trac ticket, announce your work
by linking to your github branch, and when your work is ready to be
pulled in, only then do a pull request
 - Aim for logically contained commits, commit messages of 50 char
summary line, 72 char paragraphs thereafter.
 - When upstream has changed use git rebase instead of git pull
 - When you do additional fixes to your work, use git rebase -i so
that your work still fullfills the logical commits requirement.

Lots of more details in the WIP branch. All feedback welcomed. Lets
keep the discussion of any high-level issues here on django-
developers, as the choices made impact the whole community.

The biggest issue is how we aim to use the pull requests. My take on
this is that pull requests should be only used for work ready for
committer. That is, the original author feels the work is ready, or he
doesn't know how to do anything more. If the pull requests are used
for feature requests or work-in-progress patches we risk having lots
of open tickets and lots of open pull requests.

I have tried to gather pieces of wisdom around the net. I am not too
experienced with Git, so if you have experience with the above
mentioned and/or other Git workflows feedback is appreciated.

- Anssi

--

-- 
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

Michael Manfre | 16 May 22:27
Picon
Gravatar

Django-mssql with the dream of passing the test suite

A few weeks ago, I started down the path of updating django-mssql so that it supports Django 1.4. I moved the project over to bitbucket (http://bitbucket.org/Manfre/django-mssql/), docs are deployed to read the docs (http://django-mssql.readthedocs.org), and have made it a policy of deploying packages to PyPi.

Django 1.4 support is mostly there and so far is passing all testing for the site responsible for the backend's existence (http://www.src.org). To help avoid surprises and ensure life as a 3rd party database backend maintainer is a lot less painful, I have set a goal of having django-mssql pass the test suite. This is a non-trivial task that will require changes to django and django-mssql. I've already submitted a few tickets that bring me closer to my goal and it was advised that I send this message as a heads up regarding my intentions to avoid tickets being closed with a "mssql isn't officially supported by Django" comment.

If you review one of these tickets, please keep my goal in the back of your mind. I welcome feedback on better ways of approaching my proposed changes.

Regards,
Michael Manfre

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to django-developers+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Tom Evans | 16 May 17:09

Possible session key creation regression in 1.4

Hi all

One of our sites was recently upgraded to 1.4 and now some previously
working code is failing.

The code tries to access and utilize the session id from the user, but
if it tries to do this on the request the session is created on, the
session id is None. The equivalent session object in 1.3 always
presents a valid session id.

1.3.1:

>>> import django
>>> from django.http import HttpRequest
>>> from django.conf import settings
>>> from django.utils.importlib import import_module
>>>
>>> engine = import_module(settings.SESSION_ENGINE)
>>> req = HttpRequest()
>>> req.session = engine.SessionStore(None)
>>> print django.VERSION
(1, 3, 1, 'final', 0)
>>> print req.session.session_key
a8b409a6b29ac5a59022350445f8bfa4

1.4:

>>> import django
>>> from django.http import HttpRequest
>>> from django.conf import settings
>>> from django.utils.importlib import import_module
>>>
>>> engine = import_module(settings.SESSION_ENGINE)
>>> req = HttpRequest()
>>> req.session = engine.SessionStore(None)
>>> print django.VERSION
(1, 4, 0, 'final', 0)
>>> print req.session.session_key
None

This is using the DB backend, but perusing the changes to
contrib.session, I think all backends will be similarly affected.

So, is the session key being available part of the API, or is relying
on the session key existing incorrect?

Cheers

Tom

--

-- 
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.


Gmane