Re: About using Django Auth with my app, Auto saving the User

2011-03-21 Thread Lior Sion
If instead of printing "not valid" you'll print the form itself with
the errors (as described here for example:
http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template)
you would see what the errors are. Alternatively, read about form
validation (http://docs.djangoproject.com/en/dev/ref/forms/
validation/) and try to understand why it's failing..

On Mar 20, 8:05 pm, AJ  wrote:
> No, the form submits, with other values too, to the view but it just
> does not validate.
>
> AJ

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Lior Sion
If your file is completely static (even coming from a cache server)
then there's no way of getting the csrf, since the whole point of the
csrf is that it's dynamic (otherwise it can be copied).

You can do a one time "warmup" if the cookie is not present on your
client to "get_data" from the server and initialize the cookie, or go
without csrf as suggested..

On Mar 22, 12:35 am, Brian Craft  wrote:
> No, it's not. It's a static file.
>
> On Mon, Mar 21, 2011 at 10:23 AM, Matt Robenolt
>
>
>
>
>
>
>
>  wrote:
> > Is your main view being rendered by Django or something else? If so, you'll 
> > have access to the cookie.
>
> > On Mar 21, 2011, at 1:09 PM, Brian Craft wrote:
>
> >> It's in a cookie once you coerce django into sending the cookie to the
> >> browser. This is less automatic for ajax apps, because django isn't
> >> serving the forms (which is when it usually sends the csrf cookie).
>
> >> On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
> >>  wrote:
> >>> To get the token? It's stored in a cookie. You can read that in Javascript
> >>> with document.cookie, then parse the cookie string to retrieve the 
> >>> relevant
> >>> part.
>
> >>> --
> >>> 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...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/django-users?hl=en.
>
> >> --
> >> 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...@googlegroups.com.
> >> For more options, visit this group 
> >> athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > 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...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How make CSRF middleware emit html4 rather than xhtml1.0 (closing tags issue) so will validate?

2011-03-21 Thread Chris Seberino

Ian

Thanks for the reply.  Your solution makes perfect sense.  My forms
are
automatically generated by Django via Form classes.  So I can't
embed this suggested input element in any form element present in my
template.
Where should I put this code in since there is no form element?

cs

>
>     
>         
>     
>
> (Note the '{{', '}}' delimiters, rather than '{%', '%}')
>
> A more complicated, but more reusable way to do it would be to write
> your own template tag (it's really simple, you can use the CSRF-token
> code indjango/template/defaulttags.py as a starting point) which
> would render whatever markup you need.
>
> --
> Regards,
> Ian Clelland
> 

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on django program with django-socialregistration....

2011-03-21 Thread Nge Nge
Hi Calvin

How can I install the facebook python library to my project?

Thanks
Nge

On Mar 21, 6:45 am, Calvin Spealman  wrote:
> Do you possibly have a module or package in your project named "facebook"?
> One of the requirements for django-socialauth is the facebook python
> library, but if you have another module by the same name, that could be
> imported instead.
>
>
>
> On Mon, Mar 21, 2011 at 4:23 AM, Nge Nge  wrote:
> > Hi All!
>
> > I am already tried to login from my django form via facebook login.
> > I am testing with django-socialregistration from (
> >https://github.com/flashingpumpkin/django-socialregistration.git).
> > I am facing the following error when I run my program.
> > Please help  me.. How should I do??
>
> > Nge
>
> > AttributeError at /
>
> > 'module' object has no attribute 'get_user_from_cookie'
>
> > Request Method:         GET
> > Request URL:    http://127.0.0.1:8080/
> > Django Version:         1.2.5
> > Exception Type:         AttributeError
> > Exception Value:
>
> > 'module' object has no attribute 'get_user_from_cookie'
>
> > Exception Location:     /home/mya/FBWorkSpace/FacebookTest/FacebookTest/
> > django-socialregistration/socialregistration/middleware.py in
> > process_request, line 24
> > Python Executable:      /usr/bin/python
> > Python Version:         2.6.6
> > Python Path:    ['/home/mya/FBWorkSpace/FacebookTest/FacebookTest', '/
> > usr/local/lib/python2.6/dist-packages/pyfacebook-1.0a2-py2.6.egg', '/
> > usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/
> > local/lib/python2.6/dist-packages/virtualenv-1.5.2-py2.6.egg', '/usr/
> > local/lib/python2.6/dist-packages/django_social_auth-0.3.8-py2.6.egg',
> > '/usr/local/lib/python2.6/dist-packages/python_openid-2.2.5-
> > py2.6.egg', '/usr/local/lib/python2.6/dist-packages/oauth2-1.5.167-
> > py2.6.egg', '/usr/local/lib/python2.6/dist-packages/Django-1.2.5-
> > py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/
> > usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
> > python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/
> > usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
> > PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
> > python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
> > pymodules/python2.6/gtk-2.0']
> > Server time:    Mon, 21 Mar 2011 15:19:17 -0500
>
> > --
> > 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...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Read my blog! I depend on your acceptance of my opinion! I am 
> interesting!http://techblog.ironfroggy.com/
> Follow me if you're into that sort of thing:http://www.twitter.com/ironfroggy

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on django program with django-socialregistration....

2011-03-21 Thread Nge Nge


On Mar 21, 6:45 am, Calvin Spealman  wrote:
> Do you possibly have a module or package in your project named "facebook"?
> One of the requirements for django-socialauth is the facebook python
> library, but if you have another module by the same name, that could be
> imported instead.
>
>
>
> On Mon, Mar 21, 2011 at 4:23 AM, Nge Nge  wrote:
> > Hi All!
>
> > I am already tried to login from my django form via facebook login.
> > I am testing with django-socialregistration from (
> >https://github.com/flashingpumpkin/django-socialregistration.git).
> > I am facing the following error when I run my program.
> > Please help  me.. How should I do??
>
> > Nge
>
> > AttributeError at /
>
> > 'module' object has no attribute 'get_user_from_cookie'
>
> > Request Method:         GET
> > Request URL:    http://127.0.0.1:8080/
> > Django Version:         1.2.5
> > Exception Type:         AttributeError
> > Exception Value:
>
> > 'module' object has no attribute 'get_user_from_cookie'
>
> > Exception Location:     /home/mya/FBWorkSpace/FacebookTest/FacebookTest/
> > django-socialregistration/socialregistration/middleware.py in
> > process_request, line 24
> > Python Executable:      /usr/bin/python
> > Python Version:         2.6.6
> > Python Path:    ['/home/mya/FBWorkSpace/FacebookTest/FacebookTest', '/
> > usr/local/lib/python2.6/dist-packages/pyfacebook-1.0a2-py2.6.egg', '/
> > usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/
> > local/lib/python2.6/dist-packages/virtualenv-1.5.2-py2.6.egg', '/usr/
> > local/lib/python2.6/dist-packages/django_social_auth-0.3.8-py2.6.egg',
> > '/usr/local/lib/python2.6/dist-packages/python_openid-2.2.5-
> > py2.6.egg', '/usr/local/lib/python2.6/dist-packages/oauth2-1.5.167-
> > py2.6.egg', '/usr/local/lib/python2.6/dist-packages/Django-1.2.5-
> > py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/
> > usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
> > python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/
> > usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
> > PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
> > python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
> > pymodules/python2.6/gtk-2.0']
> > Server time:    Mon, 21 Mar 2011 15:19:17 -0500
>
> > --
> > 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...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Read my blog! I depend on your acceptance of my opinion! I am 
> interesting!http://techblog.ironfroggy.com/
> Follow me if you're into that sort of thing:http://www.twitter.com/ironfroggy

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on django program with django-socialregistration....

2011-03-21 Thread Nge Nge
Hi Vikalp,

Now I already install Python-SDK in my Python Path.
But I got this error.
If possible, please guide me in details how should I do.

Thanks
Nge

On Mar 21, 7:09 am, vikalp sahni  wrote:
> https://github.com/facebook/python-sdk
>
> You have to use this.  As the method giving error is implemented on Facebook
> Python-SDK.
>
> Regards
> //Vikalp
>
> On Mon, Mar 21, 2011 at 4:15 PM, Calvin Spealman wrote:
>
> > Do you possibly have a module or package in your project named "facebook"?
> > One of the requirements for django-socialauth is the facebook python
> > library, but if you have another module by the same name, that could be
> > imported instead.
>
> > On Mon, Mar 21, 2011 at 4:23 AM, Nge Nge  wrote:
>
> >> Hi All!
>
> >> I am already tried to login from my django form via facebook login.
> >> I am testing with django-socialregistration from (
> >>https://github.com/flashingpumpkin/django-socialregistration.git).
> >> I am facing the following error when I run my program.
> >> Please help  me.. How should I do??
>
> >> Nge
>
> >> AttributeError at /
>
> >> 'module' object has no attribute 'get_user_from_cookie'
>
> >> Request Method:         GET
> >> Request URL:    http://127.0.0.1:8080/
> >> Django Version:         1.2.5
> >> Exception Type:         AttributeError
> >> Exception Value:
>
> >> 'module' object has no attribute 'get_user_from_cookie'
>
> >> Exception Location:     /home/mya/FBWorkSpace/FacebookTest/FacebookTest/
> >> django-socialregistration/socialregistration/middleware.py in
> >> process_request, line 24
> >> Python Executable:      /usr/bin/python
> >> Python Version:         2.6.6
> >> Python Path:    ['/home/mya/FBWorkSpace/FacebookTest/FacebookTest', '/
> >> usr/local/lib/python2.6/dist-packages/pyfacebook-1.0a2-py2.6.egg', '/
> >> usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/
> >> local/lib/python2.6/dist-packages/virtualenv-1.5.2-py2.6.egg', '/usr/
> >> local/lib/python2.6/dist-packages/django_social_auth-0.3.8-py2.6.egg',
> >> '/usr/local/lib/python2.6/dist-packages/python_openid-2.2.5-
> >> py2.6.egg', '/usr/local/lib/python2.6/dist-packages/oauth2-1.5.167-
> >> py2.6.egg', '/usr/local/lib/python2.6/dist-packages/Django-1.2.5-
> >> py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/
> >> usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
> >> python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/
> >> usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
> >> PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
> >> python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
> >> pymodules/python2.6/gtk-2.0']
> >> Server time:    Mon, 21 Mar 2011 15:19:17 -0500
>
> >> --
> >> 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...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Read my blog! I depend on your acceptance of my opinion! I am interesting!
> >http://techblog.ironfroggy.com/
> > Follow me if you're into that sort of thing:
> >http://www.twitter.com/ironfroggy
>
> >  --
> > 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...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: deploying flex and django

2011-03-21 Thread Vasil Vangelovski
One option is to use flash vars to pass your django app url to your flex SWF
on initialization in your HTML page.
That way you don't have to rebuild your SWF for different environments.
And you may use a django template to render the html that embeds your swf so
you can change the
url conditionally depending on if debug is set to True or False.
Maybe there's a better way, but I'm not that experienced with Flex.


On Mon, Mar 21, 2011 at 6:58 PM, Sells, Fred
wrote:

> I would appreciate some guidelines on a better way to deploy a
> flex/flash frontend with a django backend.
>
> I've got flex and django working nicely using the Flex HTTPService and
> XML and the message content.  Probably not as efficient as other methods
> but this is an intratnet and performance is not an issue.  This is also
> my first django app, and although it's grown to be pretty significant,
> it still reflects some newbie mistakes.
>
> I'm deploying on linux and apache and using mod_python (because we've
> done that for years and I have not had time to research mod_wsgi).  I'm
> more of a programmer than a Unix or Apache administrator but we are a
> small shop and you gotta do what you gotta do to make it work.
>
> Some url's have been edited to avoid exposing potentially proprietary
> info.
>
> The problem is that I deploy the client and server separately like this:
>
> /var/www/html/myapp/index.html  launches my Flex app
> /var/www/django/mysite/app ... contains my django app.
>
> This works fine EXCEPT, I need to hardcode the django url into my Flex
> App based on my target deploy something like this.
>
>private static var LOCAL :String =
> "http://localhost:/django/mysite/app/;; //I use this with the debug
> server
>private static var QA:String =
> "http://mytestserver.mydomain.org/django/mysite/app/;;
>private static var PRODUCTION:String =
> "http://myprodserver.mydomain.org/django/mysite/app/;;
>private static var DJANGO_URL:String =PRODUCTION;
>
> So I have to edit and rebuild my Flex app for the different
> environments.  While that's not much effort I know it's just bad
> practice.  I would like the url's from flex/flash to django to be
> relative and thus I guess I should deploy my flash from django, I'm just
> a bit confused about the "static" and "media" directories.  I am using
> django 1.2.4; however I could upgrade to 1.3 if that makes for a cleaner
> solution.
>
> FWIW my apache conf file looks like this.
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE app.settings
>PythonOption django.root /var/www//django/app
>PythonPath "['/var/www/django'] + sys.path"
>PythonDebug On
> 
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Matt Robenolt
Hmm, is Django and this static file on two separate servers? It's looking like 
you might just want to do a @csrf_exempt.

On Mar 21, 2011, at 6:35 PM, Brian Craft wrote:

> No, it's not. It's a static file.
> 
> On Mon, Mar 21, 2011 at 10:23 AM, Matt Robenolt
>  wrote:
>> Is your main view being rendered by Django or something else? If so, you'll 
>> have access to the cookie.
>> 
>> On Mar 21, 2011, at 1:09 PM, Brian Craft wrote:
>> 
>>> It's in a cookie once you coerce django into sending the cookie to the
>>> browser. This is less automatic for ajax apps, because django isn't
>>> serving the forms (which is when it usually sends the csrf cookie).
>>> 
>>> 
>>> On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
>>>  wrote:
 To get the token? It's stored in a cookie. You can read that in Javascript
 with document.cookie, then parse the cookie string to retrieve the relevant
 part.
 
 --
 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...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.
 
>>> 
>>> --
>>> 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...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>> 
>> 
>> --
>> 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...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>> 
>> 
> 
> -- 
> 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...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Brian Craft
No, it's not. It's a static file.

On Mon, Mar 21, 2011 at 10:23 AM, Matt Robenolt
 wrote:
> Is your main view being rendered by Django or something else? If so, you'll 
> have access to the cookie.
>
> On Mar 21, 2011, at 1:09 PM, Brian Craft wrote:
>
>> It's in a cookie once you coerce django into sending the cookie to the
>> browser. This is less automatic for ajax apps, because django isn't
>> serving the forms (which is when it usually sends the csrf cookie).
>>
>>
>> On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
>>  wrote:
>>> To get the token? It's stored in a cookie. You can read that in Javascript
>>> with document.cookie, then parse the cookie string to retrieve the relevant
>>> part.
>>>
>>> --
>>> 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...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>> --
>> 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...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Implementing a ldap db backend

2011-03-21 Thread David De La Harpe Golden
On 03/11/10 07:48, sebastien piquemal wrote:

> I have thought of many solutions to replace ldapdb. I came to
> conclusion than the cleanest, and most useful for the community, would
> be to implement a real db backend for ldap. However, I have been told
> that it is an awfully big task !
> 

It would be big...

BTW "pumpkin" is another project that attempts an ORM-like (let's say
ODM) interface.  It's not django integrated, i.e. it's not a ldap-nonrel
backend for the Django ORM, it's a separate Somewhat-Django-ORM-like
ODM.  http://pypi.python.org/pypi/pumpkin/0.1.0

I'd also recommend taking a close look at ldap.schema.models in
python-ldap source itself - it's "half an ODM" in itself, though it
can't save and still doesn't really datatype-map (python-ldap is a thin
layer on top of libldap and returns strings e.g. you get a "FALSE" back
not a python False. Yeargh), it does introspect the schema and handle
some horrible little details of attribute lookup for you.

We also grew something of an ODM for in-house use, sitting on top of
python-ldap, doing a little mapping of datatypes (only just enough for
our needs), allowing saving.  It's unreleased at time of writing and,
um, what happens to it later won't be up to me.  Pumpkin is probably
better anyway.  Our Django ORM integration, such as it is, is by "fake"
surrogate django models in RDBMS.  So again not a /backend/ for the
django ORM - Instead we (ab)use entryUUID and syncrepl entryCSN ldap
operational attributes to keep some almost featureless "LDAPEntry" model
instances in the RDBMS roughly in-sync via polling*.  This allowed
signals to fire etc so a django/celery based system can be somewhat
reactive to directory changes both inside and  outside its control.  But
our ldap directory is and will remain fairly small (thousands to tens of
thousands of entries) having an RDBMS row for every entry in ldap works
out okay, you wouldn't want to do it that way with a giant directory.

(* We toyed with the idea of making a full-blown syncrepl client on top
of python-ldap for something lighter weight than polling, but that's not
a small job either.  And there's some support in openldap for having
/slapd backend to RDBMS/, i.e. swap the problem around, but it's limited
and really only suited for specific setups...)

P.S. ldaptor also exists and is a pure-python lowlevel ldap interface
(unlike python-ldap which is on top of openldap libldap, so fully
bug-compatible with libldap)

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Parse template variables in custom tag

2011-03-21 Thread Turner


On Mar 20, 11:15 pm, Daniel Roseman  wrote:
> On Sunday, March 20, 2011 9:57:04 PM UTC, Turner wrote:
>
> > I'm working on a custom tag to which I would like to be able to pass
> > template variables and filters. I found
> > Variable(value).resolve(context) in the Django source. I
> > have a couple of questions:
>
> > You don't need to look at the code, this is explicitly documented:
>
> http://docs.djangoproject.com/en/1.2/howto/custom-template-tags/#pass...

Ah, I somehow missed that in my searching.

>
> > 1) Is it safe to use Variable()? That is, is it part of
> > the public API? Not having visibility modifiers makes it a bit
> > difficult to tell.
>
> Yes, since it is documented.
>
> > 2) Variable.resolve() works fine for, well, resolving a variable, but
> > doesn't work with filters. That is, if I pass to my tag
> > some.context.variable|some_filter, the tag will throw up
> > on the last bit, saying that it can't find an attribute/key/method
> > called  "variable|some_filter". Is there an easy way I can have my tag
> > apply any filters to the value passed in?
>
> AFAIK that should just work. The `with` tag, for example, works fine with
> arguments that include filters.

Here's the exception I get when I try a variable with filters:

Caught VariableDoesNotExist while rendering: Failed lookup for key
[path|split_path]

It's raised on the following template call:

{% my_tag list=form.instance.path|split_path %}

(split_path is, obviously, a custom filter)

In the code for my tag I have the following

Variable(value).resolve(context)

(where value is "form.instance.path|split_path")

I'm using Django version 1.3 alpha 1, if that makes a difference.

> --
> DR.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Artur Wdowiarski
Take a look at this, Brian:

http://groups.google.com/group/django-developers/browse_thread/thread/662f7f0327c177fd?pli=1

2011/3/21 Brian Craft 

> It's in a cookie once you coerce django into sending the cookie to the
> browser. This is less automatic for ajax apps, because django isn't
> serving the forms (which is when it usually sends the csrf cookie).
>
>
> On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
>  wrote:
> > To get the token? It's stored in a cookie. You can read that in
> Javascript
> > with document.cookie, then parse the cookie string to retrieve the
> relevant
> > part.
> >
> > --
> > 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...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: LibGeos in Windows XP

2011-03-21 Thread Rick
Try:-

Download
http://download.osgeo.org/osgeo4w/release/geos/geos-3.2.2-1.tar.bz2

Extract Files
copy bin/geos_c.dll to c:\Python27\DLLs\

Add following to settings.py
GEOS_LIBRARY_PATH='c:\Python27\DLLs\geos_c.dll'

I had same problem with 1.2.5, above fix for 1.3-rc1


On Feb 3, 2:59 pm, Norecces  wrote:
> Hi!
>
> Using geodjango at home on ubuntu everything is ok.
> but im trying to install it on winXP on my work
> and have some problems with lib geos.
> Ive installed PostGis.I wrote some code like this:
>
> from django.conf import settings
> settings.configure(GEOS_LIBRARY_PATH=r'c:\Python27\DLLs
> \libgeos-3-2-2.dll')
>
> where i define my geos path and i have an error:
>
> Traceback (most recent call last):
>   File "C:\Documents and Settings\workspace\DjProj\src\DjProj\way
> \views.py", line 5, in 
>     from django.contrib.gis.geos import fromstr, fromfile
>   File "C:\Python27\lib\site-packages\django\contrib\gis\geos
> \__init__.py", line 6, in 
>     from django.contrib.gis.geos.geometry import GEOSGeometry,
> wkt_regex, hex_regex
>   File "C:\Python27\lib\site-packages\django\contrib\gis\geos
> \geometry.py", line 14, in 
>     from django.contrib.gis.geos.coordseq import GEOSCoordSeq
>   File "C:\Python27\lib\site-packages\django\contrib\gis\geos
> \coordseq.py", line 9, in 
>     from django.contrib.gis.geos.libgeos import CS_PTR
>   File "C:\Python27\lib\site-packages\django\contrib\gis\geos
> \libgeos.py", line 97, in 
>     geos_version = lgeos.GEOSversion
>   File "C:\Python27\lib\ctypes\__init__.py", line 366, in __getattr__
>     func = self.__getitem__(name)
>   File "C:\Python27\lib\ctypes\__init__.py", line 371, in __getitem__
>     func = self._FuncPtr((name_or_ordinal, self))
> AttributeError: function 'GEOSversion' not found
>
> i do undersand that it is the problem with ctypes but how can i export
> this function?
> libgeos_c-1.dll  is in the same folder

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



deploying flex and django

2011-03-21 Thread Sells, Fred
I would appreciate some guidelines on a better way to deploy a
flex/flash frontend with a django backend.

I've got flex and django working nicely using the Flex HTTPService and
XML and the message content.  Probably not as efficient as other methods
but this is an intratnet and performance is not an issue.  This is also
my first django app, and although it's grown to be pretty significant,
it still reflects some newbie mistakes.

I'm deploying on linux and apache and using mod_python (because we've
done that for years and I have not had time to research mod_wsgi).  I'm
more of a programmer than a Unix or Apache administrator but we are a
small shop and you gotta do what you gotta do to make it work.

Some url's have been edited to avoid exposing potentially proprietary
info.

The problem is that I deploy the client and server separately like this:

/var/www/html/myapp/index.html  launches my Flex app
/var/www/django/mysite/app ... contains my django app.

This works fine EXCEPT, I need to hardcode the django url into my Flex
App based on my target deploy something like this.

private static var LOCAL :String =
"http://localhost:/django/mysite/app/;; //I use this with the debug
server
private static var QA:String =
"http://mytestserver.mydomain.org/django/mysite/app/;;
private static var PRODUCTION:String =
"http://myprodserver.mydomain.org/django/mysite/app/;;
private static var DJANGO_URL:String =PRODUCTION;

So I have to edit and rebuild my Flex app for the different
environments.  While that's not much effort I know it's just bad
practice.  I would like the url's from flex/flash to django to be
relative and thus I guess I should deploy my flash from django, I'm just
a bit confused about the "static" and "media" directories.  I am using
django 1.2.4; however I could upgrade to 1.3 if that makes for a cleaner
solution.

FWIW my apache conf file looks like this.


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE app.settings
PythonOption django.root /var/www//django/app
PythonPath "['/var/www/django'] + sys.path"
PythonDebug On


-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Matt Robenolt
Is your main view being rendered by Django or something else? If so, you'll 
have access to the cookie.

On Mar 21, 2011, at 1:09 PM, Brian Craft wrote:

> It's in a cookie once you coerce django into sending the cookie to the
> browser. This is less automatic for ajax apps, because django isn't
> serving the forms (which is when it usually sends the csrf cookie).
> 
> 
> On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
>  wrote:
>> To get the token? It's stored in a cookie. You can read that in Javascript
>> with document.cookie, then parse the cookie string to retrieve the relevant
>> part.
>> 
>> --
>> 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...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> 
> 
> -- 
> 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...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Brian Craft
It's in a cookie once you coerce django into sending the cookie to the
browser. This is less automatic for ajax apps, because django isn't
serving the forms (which is when it usually sends the csrf cookie).


On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
 wrote:
> To get the token? It's stored in a cookie. You can read that in Javascript
> with document.cookie, then parse the cookie string to retrieve the relevant
> part.
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Implementing a ldap db backend

2011-03-21 Thread Felipe Prenholato
Actually I reached a similar position and I'm interested enought to work on
something like that.

You are still interested or have some code to share about it?


Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc



2010/11/3 sebastien piquemal 

> Hi !
>
> I am currently on a big project, which should result in a ldap
> management service (modifying users, groups, and any other ldap
> object).
>
> Until now, I have been using django-ldapdb, in order to use ldap as a
> db backend. It was good for a very basic read-only prototype of the
> service. However, this library is not really maintained anymore, and
> due to a very high-level implementation (it only subclasses Model,
> Query, Queryset, ...), there are a lot of quirks which makes it
> unusable for more complex cases.
>
> I have thought of many solutions to replace ldapdb. I came to
> conclusion than the cleanest, and most useful for the community, would
> be to implement a real db backend for ldap. However, I have been told
> that it is an awfully big task !
>
> So, here come my questions ... Do some of you have an implementation
> of such a thing in mothballs ? Are some of you interested in sharing
> the effort for this ?
>
> If no good answer, I guess I'll just do as I was advised and implement
> for myself a few python classes based on python-ldap :-(
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to get csrf cookie in ajax app

2011-03-21 Thread Matt Robenolt
To get the token? It's stored in a cookie. You can read that in Javascript 
with document.cookie, then parse the cookie string to retrieve the relevant 
part.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Referencing Form Field Errors Lists in Views

2011-03-21 Thread hank23
I'm trying to reference errors on a new form. In the html file code I
reference them as "{{ form.fieldname.errors }}". How do I reference
those same field's errors lists in a view before I display the screen?
My goal here is to assign the focus of the screen which is about to be
displayed to be the first field on the screen which has an error in
it's errors list thereby saving the user some time and keystrokes in
moving the cursor/focus to the first field that is in error.  Thanks
for the help.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: InterfaceError: Connection already closed -- is this a regression?

2011-03-21 Thread onelson
I hear you, Russ.
I'll see if I can't get something more repeatable down in code, but as
I stated, it's an intermittent problem.
Didn't meant to sound like your 3rd option wasn't an option ("issues
with the code" is always an option). I just wanted to make sure this
wasn't a "postgres thing" that I simply didn't have the tribal
knowledge of.

Thanks for the input!

Regards,
Owen Nelson

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Logging visitors/requests and showing it all in a nice report?

2011-03-21 Thread Daniel Roseman
On Monday, March 21, 2011 1:41:40 PM UTC, MrMuffin wrote:
>
> Ok, but I want the report in django admin, nicely formatted, with
> shiny icons, charts and pies ;-)
>
> I was wondering if I should make a simple middleware to handle
> request-logging and add a few views to summarize things like os,
> browser, visitors addresses etc.
>
> Thomas
>
There is quite a nice little app called django-request that does this - I'm 
using it as part of the Mingus blog engine. 
http://kylefuller.co.uk/projects/django-request/
--
DR. 

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Logging visitors/requests and showing it all in a nice report?

2011-03-21 Thread Thomas Weholt
Ok, but I want the report in django admin, nicely formatted, with
shiny icons, charts and pies ;-)

I was wondering if I should make a simple middleware to handle
request-logging and add a few views to summarize things like os,
browser, visitors addresses etc.

Thomas

On Mon, Mar 21, 2011 at 2:27 PM, Shawn Milochik  wrote:
> It sounds like you want webalizer or awstats. They use your server log info.
>
> Shawn
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How can I run my django project with django-social-auth?

2011-03-21 Thread Daniel Roseman
On Monday, March 21, 2011 7:09:58 AM UTC, Su Yi Kyaing wrote:
>
> Dear All! 
>
> I want to create Django login form via facebook. So I am using with 
> django-social-auth. 
> Can every one guide me in detail how should I do continuously after 
> clone django-social-auth to my project? 
>
> Regards 
> Su


Don't "clone" an app into your project. Just install it somewhere on your 
PYTHONPATH. Virtualenv makes this easy, by giving you a custom environment 
that is specific to each project.
--
DR. 

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How can I run my django project with django-social-auth?

2011-03-21 Thread CrabbyPete
Its an app that that gets installed into your project. What helped me
understand how this works the best is to look at the pinax project. I
didn't use the code but looking at it is a great way to learn.

http://pinaxproject.com/


On Mar 21, 3:09 am, Su Yi Kyaing  wrote:
> Dear All!
>
> I want to create Django login form via facebook. So I am using with
> django-social-auth.
> Can every one guide me in detail how should I do continuously after
> clone django-social-auth to my project?
>
> Regards
> Su

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Logging visitors/requests and showing it all in a nice report?

2011-03-21 Thread Shawn Milochik
It sounds like you want webalizer or awstats. They use your server log info.

Shawn

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Logging visitors/requests and showing it all in a nice report?

2011-03-21 Thread Thomas Weholt
Is there an app for logging visitors with a nice report, like a report
showing number of visitors for a specific page, users with a specific
browser/OS etc?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Pagination of Search Results - URL issue

2011-03-21 Thread Daniel Roseman


On Monday, March 21, 2011 4:49:34 AM UTC, Andrew Godfrey wrote:
>
> Hi, 
>
> I am paginating the output of a query. Everything works fine and the 
> first page of results is displayed. The problem is that the url to 
> access pages 2 (http://127.0.0.1:8000/search/?page=2) and following 
> fall back to the search form and do not display the second page of 
> results. 
>

Yes, because you are using POST for the search query, and subsequent 
requests are GETs.

So, don't do that. Search forms are a case where GET is the right method to 
use: they don't update anything on the server, they simply request 
information. You should include the search query on every pagination link.
--
DR.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django, request.user is anonymous user in subsequent requests.

2011-03-21 Thread A
I am trying to use couchdb as the backend for my application. The
database instance is exposed via a webservice which has authentication
methods.

I am using in memory cache and in memory sessions as we do not have a
relational database.

For authenticating against couch, I have written custom authentication
backend.

The code for my login method:
if SESSION_KEY in request.session:
if request.session[SESSION_KEY] != user.id:
request.session.flush()
else:
request.session.cycle_key()
request.session[SESSION_KEY] = user.id
request.session[BACKEND_SESSION_KEY] = user.backend
request.user = user

user is a custom object here which does not derive from Dj\ango's auth
User class.

On subsequent requests, request.user is anonymous user. What am I
missing?
However, I can get my user if I save it in the session manually. but I
am worried how that will affect by ability tp use other Django/third
party modules.
I am new to both Python and Django and I am sure this is something
obvious.

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: unit tests and setUp method

2011-03-21 Thread Martin Tiršel

The problem was, that I assigned default settings this way:

DEFAULT_SETTINGS = {...}
...
self.settings = DEFAULT_SETTINGS

I changed it to:

self.settings = DEFAULT_SETTINGS.copy()

And it is ok now :)

Martin

On Wed, 16 Mar 2011 00:49:15 +0100, Karen Tracey   
wrote:


On Tue, Mar 15, 2011 at 6:40 PM, Martin Tiršel   
wrote:



I am new to unit tests and I am using django.test.TestCase. What I don't
understand, is this situation


class GameWorldTests(TestCase):
   def setUp(self):
   self.test_world = GameWorld.objects.create(
   name='Testing world',
   game=GameWorld.GAME_TYPE_XY,
   domain='test.xy.com'
   )
   print self.test_world.settings['world_width']



What is that settings attribute and how is it attached to a GameWorld
instance?

(Yes, the DB is reset and setUp is called between each test function  
run.)


Karen


--
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How can I run my django project with django-social-auth?

2011-03-21 Thread Su Yi Kyaing
Dear All!

I want to create Django login form via facebook. So I am using with
django-social-auth.
Can every one guide me in detail how should I do continuously after
clone django-social-auth to my project?

Regards
Su

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Pagination of Search Results - URL issue

2011-03-21 Thread Andrew Godfrey
Hi,

I am paginating the output of a query. Everything works fine and the
first page of results is displayed. The problem is that the url to
access pages 2 (http://127.0.0.1:8000/search/?page=2) and following
fall back to the search form and do not display the second page of
results.

urls.py
urlpatterns = patterns('',

(r'^search/', views.search_photos),
)

views.py
def search_photos(request):
if request.method == 'POST':
form = SearchForm(request.POST)
if form.is_valid():
querytext = form.cleaned_data['querytext']
search_result =
Photo.objects.filter(title__icontains=querytext).order_by('date_taken')
paginated_list = Paginator(search_result, 25)
try:
   page = int(request.GET.get('page', '1'))
except ValueError:
   page = 1
try:
   paginated_list = paginated_list.page(page)
except (EmptyPage, InvalidPage):
   paginated_list =
paginated_list.page(paginated_list.num_pages)
return render_to_response('photologue/
photo_list_searched.html', {'paginated_list': paginated_list})
else:
form = SearchForm()
return render_to_response('search.html', {'form': form,})

search.html
...
{% block content %}
  

{{ form.as_p }}


   


photo_list_searched.html
...
{% block title %}
{% if paginated_list.paginator.count %}
Found {{ paginated_list.paginator.count }} photos, displaying 25
per page. 
{% else %}
No photos were found.
{% endif %}
{% endblock %}

{% block content %}
{% if paginated_list.paginator.count %}


{% if paginated_list.has_previous %}
previous
{% endif %}

Pages {{ paginated_list.number }} of
{{ paginated_list.paginator.num_pages }}

{% if paginated_list.has_next %}
next
{% endif %}




{% for photo in paginated_list.object_list %}
 
 
 {{photo.title}}
 Date Taken: {{photo.date_taken|date:"j F Y"}}
 Link to large image: {{ photo.image.url }}
 
 {% endfor %}

 
{% else %}
Please try again using more specific words. If you are still unable
to find what you are looking for, use the contact page to request
help.
{% endif %}
{% endblock %}

Thanks in advance,

Andrew

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: orm: operations between models fields

2011-03-21 Thread Tomasz Zieliński
On 19 Mar, 22:49, maxi  wrote:
> Hi,
>
> Which is the better way to do this on orm language ?
>
> select filed1, sum(field2 * field3)
> from a_table
> group by field1
>

I believe this is not possible in the current Django ORM.
It would need something like this to work:

   MyModel.objects.annotate(mult_result=F('field2') *
F('field3')).values('field1').annotate(sum_result=Sum('mult_result'))

- which I find much more ugly than the raw SQL.

Also, you doesn't seem to need to get database rows (objects), just
some custom statistics, and ORM stands for Object-Relational Mapper,
which also makes the SQL way perfectly justified.

--
Tomasz Zielinski
pyconsultant.eu

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on django program with django-socialregistration....

2011-03-21 Thread vikalp sahni
https://github.com/facebook/python-sdk

You have to use this.  As the method giving error is implemented on Facebook
Python-SDK.

Regards
//Vikalp

On Mon, Mar 21, 2011 at 4:15 PM, Calvin Spealman wrote:

> Do you possibly have a module or package in your project named "facebook"?
> One of the requirements for django-socialauth is the facebook python
> library, but if you have another module by the same name, that could be
> imported instead.
>
>
> On Mon, Mar 21, 2011 at 4:23 AM, Nge Nge  wrote:
>
>> Hi All!
>>
>> I am already tried to login from my django form via facebook login.
>> I am testing with django-socialregistration from (
>> https://github.com/flashingpumpkin/django-socialregistration.git).
>> I am facing the following error when I run my program.
>> Please help  me.. How should I do??
>>
>> Nge
>>
>> AttributeError at /
>>
>> 'module' object has no attribute 'get_user_from_cookie'
>>
>> Request Method: GET
>> Request URL:http://127.0.0.1:8080/
>> Django Version: 1.2.5
>> Exception Type: AttributeError
>> Exception Value:
>>
>> 'module' object has no attribute 'get_user_from_cookie'
>>
>> Exception Location: /home/mya/FBWorkSpace/FacebookTest/FacebookTest/
>> django-socialregistration/socialregistration/middleware.py in
>> process_request, line 24
>> Python Executable:  /usr/bin/python
>> Python Version: 2.6.6
>> Python Path:['/home/mya/FBWorkSpace/FacebookTest/FacebookTest', '/
>> usr/local/lib/python2.6/dist-packages/pyfacebook-1.0a2-py2.6.egg', '/
>> usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/
>> local/lib/python2.6/dist-packages/virtualenv-1.5.2-py2.6.egg', '/usr/
>> local/lib/python2.6/dist-packages/django_social_auth-0.3.8-py2.6.egg',
>> '/usr/local/lib/python2.6/dist-packages/python_openid-2.2.5-
>> py2.6.egg', '/usr/local/lib/python2.6/dist-packages/oauth2-1.5.167-
>> py2.6.egg', '/usr/local/lib/python2.6/dist-packages/Django-1.2.5-
>> py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/
>> usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
>> python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/
>> usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
>> PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
>> python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
>> pymodules/python2.6/gtk-2.0']
>> Server time:Mon, 21 Mar 2011 15:19:17 -0500
>>
>> --
>> 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...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Read my blog! I depend on your acceptance of my opinion! I am interesting!
> http://techblog.ironfroggy.com/
> Follow me if you're into that sort of thing:
> http://www.twitter.com/ironfroggy
>
>  --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on django program with django-socialregistration....

2011-03-21 Thread Calvin Spealman
Do you possibly have a module or package in your project named "facebook"?
One of the requirements for django-socialauth is the facebook python
library, but if you have another module by the same name, that could be
imported instead.

On Mon, Mar 21, 2011 at 4:23 AM, Nge Nge  wrote:

> Hi All!
>
> I am already tried to login from my django form via facebook login.
> I am testing with django-socialregistration from (
> https://github.com/flashingpumpkin/django-socialregistration.git).
> I am facing the following error when I run my program.
> Please help  me.. How should I do??
>
> Nge
>
> AttributeError at /
>
> 'module' object has no attribute 'get_user_from_cookie'
>
> Request Method: GET
> Request URL:http://127.0.0.1:8080/
> Django Version: 1.2.5
> Exception Type: AttributeError
> Exception Value:
>
> 'module' object has no attribute 'get_user_from_cookie'
>
> Exception Location: /home/mya/FBWorkSpace/FacebookTest/FacebookTest/
> django-socialregistration/socialregistration/middleware.py in
> process_request, line 24
> Python Executable:  /usr/bin/python
> Python Version: 2.6.6
> Python Path:['/home/mya/FBWorkSpace/FacebookTest/FacebookTest', '/
> usr/local/lib/python2.6/dist-packages/pyfacebook-1.0a2-py2.6.egg', '/
> usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/
> local/lib/python2.6/dist-packages/virtualenv-1.5.2-py2.6.egg', '/usr/
> local/lib/python2.6/dist-packages/django_social_auth-0.3.8-py2.6.egg',
> '/usr/local/lib/python2.6/dist-packages/python_openid-2.2.5-
> py2.6.egg', '/usr/local/lib/python2.6/dist-packages/oauth2-1.5.167-
> py2.6.egg', '/usr/local/lib/python2.6/dist-packages/Django-1.2.5-
> py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/
> usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
> python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/
> usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
> PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
> python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
> pymodules/python2.6/gtk-2.0']
> Server time:Mon, 21 Mar 2011 15:19:17 -0500
>
> --
> 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...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing:
http://www.twitter.com/ironfroggy

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Error on django program with django-socialregistration....

2011-03-21 Thread Nge Nge
Hi All!

I am already tried to login from my django form via facebook login.
I am testing with django-socialregistration from (
https://github.com/flashingpumpkin/django-socialregistration.git).
I am facing the following error when I run my program.
Please help  me.. How should I do??

Nge

AttributeError at /

'module' object has no attribute 'get_user_from_cookie'

Request Method: GET
Request URL:http://127.0.0.1:8080/
Django Version: 1.2.5
Exception Type: AttributeError
Exception Value:

'module' object has no attribute 'get_user_from_cookie'

Exception Location: /home/mya/FBWorkSpace/FacebookTest/FacebookTest/
django-socialregistration/socialregistration/middleware.py in
process_request, line 24
Python Executable:  /usr/bin/python
Python Version: 2.6.6
Python Path:['/home/mya/FBWorkSpace/FacebookTest/FacebookTest', '/
usr/local/lib/python2.6/dist-packages/pyfacebook-1.0a2-py2.6.egg', '/
usr/local/lib/python2.6/dist-packages/pip-0.8.3-py2.6.egg', '/usr/
local/lib/python2.6/dist-packages/virtualenv-1.5.2-py2.6.egg', '/usr/
local/lib/python2.6/dist-packages/django_social_auth-0.3.8-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/python_openid-2.2.5-
py2.6.egg', '/usr/local/lib/python2.6/dist-packages/oauth2-1.5.167-
py2.6.egg', '/usr/local/lib/python2.6/dist-packages/Django-1.2.5-
py2.6.egg', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/
usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/
usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/
PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
pymodules/python2.6/gtk-2.0']
Server time:Mon, 21 Mar 2011 15:19:17 -0500

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Selecting a shopping cart

2011-03-21 Thread Isaac XxX
Hi there,

Recently I decided to develop a project that will involve some shopping cart
capabilities (we will sell some products, mainly by using credit card
payment methods).

I've been checking some packages - frameworks, and I can decide wich is
better fit for me. By now, I visited the following:

- LFS: Not a bad choices, but I found it a bit hard to be customized.
- Satchless: Maybe an early stage
- Satchmore: Seems a good choice, but still beign a framework. Maybe an app
is better fitted for me.
- DjangoShop: Seems that people are developing it to be a django built-in,
and it can be an interesting point to use it. However, there is not good
documentation / examples about its use and capabilities

By the way, I wish that selected package offer me a really deep level of
customization, but giving an inicial ready-to-use base to be started from.
Something like LFS do (only install framework and initialize db, and then
you have a shop ready), but being able to customize it in the way I want
(use or not portlets, use custom templates for whole / part of web, activate
shopping cart only in parts of the given web site...)

Thanks in advance,

Greetings

-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.