reverse funtion returns fully qualified names

2012-10-03 Thread Jani Tiainen

Hi,

since we tried to upgrade our systems to work with 1.4 something very 
unexpected started to happen:


reverse('my_view_name')

Started to respond with fully qualified URL including domain name. And 
since our Django servers are behind proxies and load balancers it 
started to create very interesting effect since it now returns URL with 
domain name from local machine.


Django 1.3 does return only absolute URL without domain name and 
everything works as expected.


Though if you use same code (we had to upgrade few settings) with 1.3 it 
seems to still create fully qualified URLs with domain names.


Is there some middleware or setting that affects in a behaviour we now 
experience?


--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

--
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: app for kickstarter-like goals

2012-10-03 Thread Matteo Suppo
I just wanted to be sure there wasn't already something.

So, since I found nothing, I guess I'll start build it. See ya and Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Akk6r4uxdFAJ.
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: send_mail on MAC OS X 10.7

2012-10-03 Thread Kolbe
did you start the sendmail program?

On Tuesday, October 2, 2012 8:45:38 AM UTC+8, Cheng wrote:
>
> Hi,
>
> I am new to django.
>
> I am following The Definitive Guide to Django SECOND EDITION by Adrian 
> Holovaty and Jacob Kaplan -Moss and I cannot get the contact form to send 
> mail. First the eg did not work at all until I added the @csrf-exempt 
> decorator. Keeps getting Error 61 Connection Failure after that. 
>
> Would be grateful if someone can help.
>
> Thanks,
> Cheng
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/jxyunyZbPr8J.
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: Invalidating active sessions after a password change?

2012-10-03 Thread Tom Evans
On Tue, Oct 2, 2012 at 7:50 PM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> On Tue, Oct 2, 2012 at 5:23 PM, Tom Evans  wrote:
>> I did not say that it was not a desired feature, I said that
>> *personally* I would not have that expectation; this may be due to me
>> fully understanding how such systems work and, as I indicated, a lay
>> person may think differently.
>
>
> That sure is a loaded comment, let's keep the dick size wars out of this
> yeah? :)
>

It's not a loaded comment at all, this isn't a "dick size war".

>>
>> Other large commercial systems, for
>> instance google apps, do not behave in this manner, so I'm not sure
>> where the expectation comes from - can anyone name a public facing
>> system that invalidates all other sessions on password change?
>
>
> Let's see.. Facebook?
>
> --snip--
> "Log out of other devices? To make sure your account's secure, we can log
> you out of any other computers and phones. You can log back in with your new
> password."
> --snip
>
> The only difference is that Facebook make it an optional feature that pops
> up immediately after you change the password.

So not what your proposed solution allows, but instead session tracking...

>
> The expectation comes from a simple logic. If I change my password, I want
> to think that my account is secure from anyone else that previously had it.
>
>>
>> As a corollary, remember that django's authentication contrib package,
>> django.contrib.auth, is designed to be a *base* that all AAA schemes
>> can be built around. There are many schemes where a user may have many
>> passwords for a single account, should changing one of them invalidate
>> all their other sessions?
>
>
> That's a different question entirely, and comes down to a business logic
> choice, not a technical "one-fits-all".

This is point 1.

>
>>
>>
>> As I said in my original reply, these sorts of BI rules can trivially
>> be added on top of d.c.auth. I gave one such mechanism, Cal another.
>> Cal's solution is more about ensuring that only sessions that have the
>> current valid password hash are allowed, whilst mine is more about
>> tracking and invalidating specific sessions on a whim.
>
>
> The solution I specified was the most simple approach possible, and could be
> integrated without too much fuss.

See point 1. Your solution is the most simplistic approach to solve
this explicit use case, but implementing it in base would mean ruling
out many AAA schemes. Thanks for making my argument for me.


Tom

-- 
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: reverse funtion returns fully qualified names

2012-10-03 Thread Jani Tiainen
Replying to myself.

It was oldish version of django-rest-framework that did mangled prefix.
With latest version (0.4.0 in my case) it's fixed.

On Wed, Oct 3, 2012 at 10:29 AM, Jani Tiainen  wrote:

> Hi,
>
> since we tried to upgrade our systems to work with 1.4 something very
> unexpected started to happen:
>
> reverse('my_view_name')
>
> Started to respond with fully qualified URL including domain name. And
> since our Django servers are behind proxies and load balancers it started
> to create very interesting effect since it now returns URL with domain name
> from local machine.
>
> Django 1.3 does return only absolute URL without domain name and
> everything works as expected.
>
> Though if you use same code (we had to upgrade few settings) with 1.3 it
> seems to still create fully qualified URLs with domain names.
>
> Is there some middleware or setting that affects in a behaviour we now
> experience?
>
> --
> Jani Tiainen
>
> - Well planned is half done and a half done has been sufficient before...
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 by Example blog Tutorial

2012-10-03 Thread Tuss4
This is my first time posting in the Django user group. I've been following 
the following lightbird Django by Example tutorials. I've hit a snag while 
following the blog tutorial (http://lightbird.net/dbe/blog.html). The thing 
is my comment link [code]

Comments

[/code]

is not linking to the individual post. I checked my views.py and urls.py 
against the tutorial source code packet and it matches, but upon clicking 
it just displays the front page again. When you look at the url however you 
can see the posts primary key in the adress, but all posts are displayed. 

I'm ready to provide any information as needed. Thank you in advance for 
your help.

In short, my blog isn't linking to individual posts.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/OyE9I2FNd2sJ.
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: Ecommerce Solution

2012-10-03 Thread Swaroop Shankar V
Hi All,
I was checking out different option and found django-oscar interesting and
it is frequently updated too. Have anyone tried it out? What is your take
on that project? Is it worth a try?

Thanks and Regards,
Swaroop Shankar V



On Thu, Aug 30, 2012 at 5:06 PM, Swaroop Shankar V wrote:

> Mario, is it possible to integrate LFS with an existing django project?
> Also is there any method to import the data from my existing satchmo
> installation to LFS?
>
> Swaroop Shankar V
>
>
>
>
> On Mon, Aug 27, 2012 at 10:31 PM, Mario Menezes wrote:
>
>> LFS is another option. Lightning Fast Shop is the promise in the name :-)
>>
>> www.getlfs.com
>>
>> Disclaimer: I'm not affiliate with LFS; we've used it for a project (
>> www.qmaterial.com.br) that is not a ecommerce, but has a significant
>> number of similar features (except ecommerce) that using a ecommerce
>> solution was the obvious solution.
>>
>> Best regards,
>>
>> Mário Menezes
>>
>>
>> Em domingo, 26 de agosto de 2012 17h03min25s UTC-3, Swaroop Shankar
>> escreveu:
>>
>>> Hi All,
>>> Previously I had asked similar question on this group and decided to go
>>> with Satchmo. After the implementation it turned out to be bit difficult to
>>> maintain since the system do not provide much plugin or customization
>>> support. So am thinking of implementing another ecommerce solution. The
>>> system am looking for is an app which I can use with my existing site. Also
>>> It would be better if the system would support a mechanism to migrate the
>>> existing data from satchmo. I checked few but almost every project lacks
>>> proper documentation. So is there any django ecommerce project that have
>>> good documentation and easy to integrate?
>>>
>>> Thanks and Regards,
>>>
>>> Swaroop Shankar V
>>>
>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/_GQrKjmFzTYJ.
>>
>> 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: Django by Example blog Tutorial

2012-10-03 Thread Tom Evans
On Wed, Oct 3, 2012 at 8:14 AM, Tuss4  wrote:
> This is my first time posting in the Django user group. I've been following
> the following lightbird Django by Example tutorials. I've hit a snag while
> following the blog tutorial (http://lightbird.net/dbe/blog.html). The thing
> is my comment link [code]
>
> Comments
>
> [/code]
>
> is not linking to the individual post. I checked my views.py and urls.py
> against the tutorial source code packet and it matches, but upon clicking it
> just displays the front page again. When you look at the url however you can
> see the posts primary key in the adress, but all posts are displayed.
>
> I'm ready to provide any information as needed. Thank you in advance for
> your help.
>
> In short, my blog isn't linking to individual posts.
>

So the URL generated looks "correct", but when you click on it, it
instead displays a different page?

That sounds like the URL is getting routed to the incorrect view.
Check your urls.py, does the view that gets displayed match the URL
(even partially)? Django will stop processing the urls.py for a
request once it has found the first URL regular expression that
matches the current URL.

Eg, if your urls.py has these patterns in it:

""
"blogs/(?P\d+)"

and then you request "/blogs/5", then the first regexp will match, and
it will not look any further. To stop this, you should properly start
and terminate your regular expressions with '^' and '$', which mean
start and end of string respectively:

"^$"
"^blogs/(?P\d+)$"

Cheers

Tom

-- 
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: Invalidating active sessions after a password change?

2012-10-03 Thread Cal Leeming [Simplicity Media Ltd]
Yeah, this debate is borderline silly now.

OP, in a nut shell;

1) It is completely acceptable to revoke all other sessions after a
password change
2) There are many ways to revoke sessions, pick one that is right for your
use case.
3) Whether session revoking is enforced or optional is a choice for you.

Hope this helps!

Cal

On Wed, Oct 3, 2012 at 9:40 AM, Tom Evans  wrote:

> On Tue, Oct 2, 2012 at 7:50 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > On Tue, Oct 2, 2012 at 5:23 PM, Tom Evans 
> wrote:
> >> I did not say that it was not a desired feature, I said that
> >> *personally* I would not have that expectation; this may be due to me
> >> fully understanding how such systems work and, as I indicated, a lay
> >> person may think differently.
> >
> >
> > That sure is a loaded comment, let's keep the dick size wars out of this
> > yeah? :)
> >
>
> It's not a loaded comment at all, this isn't a "dick size war".
>
> >>
> >> Other large commercial systems, for
> >> instance google apps, do not behave in this manner, so I'm not sure
> >> where the expectation comes from - can anyone name a public facing
> >> system that invalidates all other sessions on password change?
> >
> >
> > Let's see.. Facebook?
> >
> > --snip--
> > "Log out of other devices? To make sure your account's secure, we can log
> > you out of any other computers and phones. You can log back in with your
> new
> > password."
> > --snip
> >
> > The only difference is that Facebook make it an optional feature that
> pops
> > up immediately after you change the password.
>
> So not what your proposed solution allows, but instead session tracking...
>
> >
> > The expectation comes from a simple logic. If I change my password, I
> want
> > to think that my account is secure from anyone else that previously had
> it.
> >
> >>
> >> As a corollary, remember that django's authentication contrib package,
> >> django.contrib.auth, is designed to be a *base* that all AAA schemes
> >> can be built around. There are many schemes where a user may have many
> >> passwords for a single account, should changing one of them invalidate
> >> all their other sessions?
> >
> >
> > That's a different question entirely, and comes down to a business logic
> > choice, not a technical "one-fits-all".
>
> This is point 1.
>
> >
> >>
> >>
> >> As I said in my original reply, these sorts of BI rules can trivially
> >> be added on top of d.c.auth. I gave one such mechanism, Cal another.
> >> Cal's solution is more about ensuring that only sessions that have the
> >> current valid password hash are allowed, whilst mine is more about
> >> tracking and invalidating specific sessions on a whim.
> >
> >
> > The solution I specified was the most simple approach possible, and
> could be
> > integrated without too much fuss.
>
> See point 1. Your solution is the most simplistic approach to solve
> this explicit use case, but implementing it in base would mean ruling
> out many AAA schemes. Thanks for making my argument for me.
>
>
> Tom
>
> --
> 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.



Migrating a Django project to new platform

2012-10-03 Thread Elliot
Hi all,

I would like some help or advice migrating an old Django project to a 
different platform.

Firstly, I am ok-ish with linux (mainly CentOS), and created basic 
websites, MySQL/PHP/HTML intranets, but know next to nothing about Django 
or CMS systems in general, so I appreciate that this is quite a challenge 
for me!

So, I have access to a Ubuntu 11 box which is currently hosting a Django 
v0.97 site. I need to move this site to a CentOS5 (Python v2.4.3) box. 
There isn't really anything to upset on the CentOS box so I am clear to 
uninstall and shuffle stuff around. I have ran a full 'yum update' on 
CentOS.

I have obviously started by transferring the ubuntu:/var/www/hayley folder 
to centos:/var/www/hayley and setting up Apache.

Googling has had me ensure the following are installed:
yum install gcc gcc-c++
yum install zlib-devel
yum install subversion
yum install MySQL-python python-devel
yum install mod_python
yum install httpd-devel
yum install memcached
yum install mysql-server
yum install python-devel mysql-devel
yum install python-setuptools
http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
easy_install PIL
easy_install sorl-thumbnail

I have ran the installer for Django, found in /var/www/hayley/django-nfa.

I have encountered a tonne of issues so far, which I have been resolving 
with the aid of Google, but I feel I am still a long way off getting this 
to work. In it's current state, if I attempt to access the site, I receive 
an 'internal server error' [500], and my httpd log shows:
"ImproperlyConfigured: Error while importing URLconf 'hayley.urls': No 
module named sorl"

At this point, I would like to ask:
1) Are there are any obvious packages I am missing?
2) Even though I believe I have installed sorl-thumbnail, the above error 
obviously indicates an issue. Can someone please suggest where to look in 
order to address it?
3) Given this type of migration, is there anything obvious which I need to 
account for?

Thanks all!

Elliot

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SbBegpsGOTUJ.
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: Migrating a Django project to new platform

2012-10-03 Thread Cal Leeming [Simplicity Media Ltd]
That's strange, sorl-thumbnail didn't seem to resolve your problem.

First thing I'd do is identify the line of code that is causing this import
problem (do a search for 'sorl' in your code base). From there, identify
some of the function names being called on sorl in your application, and
add those to the Google search. That might help identify what the module is
and where you can find it.

Let us know what you find!

Cal


On Wed, Oct 3, 2012 at 12:51 PM, Elliot wrote:

> Hi all,
>
> I would like some help or advice migrating an old Django project to a
> different platform.
>
> Firstly, I am ok-ish with linux (mainly CentOS), and created basic
> websites, MySQL/PHP/HTML intranets, but know next to nothing about Django
> or CMS systems in general, so I appreciate that this is quite a challenge
> for me!
>
> So, I have access to a Ubuntu 11 box which is currently hosting a Django
> v0.97 site. I need to move this site to a CentOS5 (Python v2.4.3) box.
> There isn't really anything to upset on the CentOS box so I am clear to
> uninstall and shuffle stuff around. I have ran a full 'yum update' on
> CentOS.
>
> I have obviously started by transferring the ubuntu:/var/www/hayley folder
> to centos:/var/www/hayley and setting up Apache.
>
> Googling has had me ensure the following are installed:
> yum install gcc gcc-c++
> yum install zlib-devel
> yum install subversion
> yum install MySQL-python python-devel
> yum install mod_python
> yum install httpd-devel
> yum install memcached
> yum install mysql-server
> yum install python-devel mysql-devel
> yum install python-setuptools
> http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
> http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
> easy_install PIL
> easy_install sorl-thumbnail
>
> I have ran the installer for Django, found in /var/www/hayley/django-nfa.
>
> I have encountered a tonne of issues so far, which I have been resolving
> with the aid of Google, but I feel I am still a long way off getting this
> to work. In it's current state, if I attempt to access the site, I receive
> an 'internal server error' [500], and my httpd log shows:
> "ImproperlyConfigured: Error while importing URLconf 'hayley.urls': No
> module named sorl"
>
> At this point, I would like to ask:
> 1) Are there are any obvious packages I am missing?
> 2) Even though I believe I have installed sorl-thumbnail, the above error
> obviously indicates an issue. Can someone please suggest where to look in
> order to address it?
> 3) Given this type of migration, is there anything obvious which I need to
> account for?
>
> Thanks all!
>
> Elliot
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/SbBegpsGOTUJ.
> 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: app for kickstarter-like goals

2012-10-03 Thread Andre Santos
You could also search for "gamification".
https://www.google.com.br/search?q=gamification+%2B+django&oq=gamification+%2B+django&sugexp=chrome,mod=9&sourceid=chrome&ie=UTF-8

2012/10/3 Matteo Suppo 

> I just wanted to be sure there wasn't already something.
>
> So, since I found nothing, I guess I'll start build it. See ya and Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Akk6r4uxdFAJ.
>
> 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: send_mail on MAC OS X 10.7

2012-10-03 Thread Cheng
Hi Dennis,

I am not familiar with setting up the Mac. How do I check the STMP service 
on the Mac?

I am able to send email through the Mac's Mail application though. The 
outgoing mail server for the Mail application is smtp.googlemail.com. The 
incoming mail server for the Mail application is imap.googlemail.com.

Thanks,
Cheng 

On Tuesday, October 2, 2012 9:45:17 AM UTC-7, Dennis Lee Bieber wrote:
>
> On Tue, 2 Oct 2012 07:25:39 -0700 (PDT), Cheng 
> > 
>
> declaimed the following in gmane.comp.python.django.user: 
>
> > 
> > I commented it, but it still gives me error 61 - Connection refused. 
> > 
> How is the outgoing email SMTP configuration specified? 
>
>  
> -- 
> Wulfraed Dennis Lee Bieber AF6VN 
> wlf...@ix.netcom.com 
> HTTP://wlfraed.home.netcom.com/ 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/V_tyVy8ZqSAJ.
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: send_mail on MAC OS X 10.7

2012-10-03 Thread Cheng
Hi Kobe,

I am not familiar with the Mac's setup.
Do you mean the Mac's Mail application?  If so, yes. If not, how do I start 
the sendmail program?

Thanks,
Cheng

On Wednesday, October 3, 2012 1:37:45 AM UTC-7, Kolbe wrote:
>
> did you start the sendmail program?
>
> On Tuesday, October 2, 2012 8:45:38 AM UTC+8, Cheng wrote:
>>
>> Hi,
>>
>> I am new to django.
>>
>> I am following The Definitive Guide to Django SECOND EDITION by Adrian 
>> Holovaty and Jacob Kaplan -Moss and I cannot get the contact form to send 
>> mail. First the eg did not work at all until I added the @csrf-exempt 
>> decorator. Keeps getting Error 61 Connection Failure after that. 
>>
>> Would be grateful if someone can help.
>>
>> Thanks,
>> Cheng
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VIOCOKZcatsJ.
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: Migrating a Django project to new platform

2012-10-03 Thread Bill Freeman
A bit of generic advice:

Be sure that you know which python is running your stuff: mod_wsgi,
and IIRC mod_python (if the site really uses it) are bound to a
specific python interpreter.  It may or may not be the one where you
installed sorl-thumbnail.  One question is whether the:

python manage.py shell

will start.  If that works, runserver (the development server will
probably work (I'm guessing that you've been testing via Apache).  If
so, then use the shell to pretty print sys.path, to find out where
that configuration is finding stuff:

from pprint import pprint
import sys
pprint(sys.path)

You can also write a trivial WSGI "application" (it's just a function)
that creates a text/plain response giving the same information for
that environment.  You can also capture sys.version to confirm that
both pythons are, say, a 2.7.x or not.

If both pythons are compatible versions (not, say, a 2.6 and a 2.7),
you may be able to fix things with the python-path argument to the
WSGIDaemonProcess directive (specific to the daemon process group) or
more globally by using a WSGIPythonHome or WSGIPythonPath directive.
But it is also possible to install stuff in the python that mod_wsgi
is using be default, and to arrange for any manage.py actions you need
to run with that python.

Bill

On Wed, Oct 3, 2012 at 7:51 AM, Elliot  wrote:
> Hi all,
>
> I would like some help or advice migrating an old Django project to a
> different platform.
>
> Firstly, I am ok-ish with linux (mainly CentOS), and created basic websites,
> MySQL/PHP/HTML intranets, but know next to nothing about Django or CMS
> systems in general, so I appreciate that this is quite a challenge for me!
>
> So, I have access to a Ubuntu 11 box which is currently hosting a Django
> v0.97 site. I need to move this site to a CentOS5 (Python v2.4.3) box. There
> isn't really anything to upset on the CentOS box so I am clear to uninstall
> and shuffle stuff around. I have ran a full 'yum update' on CentOS.
>
> I have obviously started by transferring the ubuntu:/var/www/hayley folder
> to centos:/var/www/hayley and setting up Apache.
>
> Googling has had me ensure the following are installed:
> yum install gcc gcc-c++
> yum install zlib-devel
> yum install subversion
> yum install MySQL-python python-devel
> yum install mod_python
> yum install httpd-devel
> yum install memcached
> yum install mysql-server
> yum install python-devel mysql-devel
> yum install python-setuptools
> http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
> http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
> easy_install PIL
> easy_install sorl-thumbnail
>
> I have ran the installer for Django, found in /var/www/hayley/django-nfa.
>
> I have encountered a tonne of issues so far, which I have been resolving
> with the aid of Google, but I feel I am still a long way off getting this to
> work. In it's current state, if I attempt to access the site, I receive an
> 'internal server error' [500], and my httpd log shows:
> "ImproperlyConfigured: Error while importing URLconf 'hayley.urls': No
> module named sorl"
>
> At this point, I would like to ask:
> 1) Are there are any obvious packages I am missing?
> 2) Even though I believe I have installed sorl-thumbnail, the above error
> obviously indicates an issue. Can someone please suggest where to look in
> order to address it?
> 3) Given this type of migration, is there anything obvious which I need to
> account for?
>
> Thanks all!
>
> Elliot

-- 
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.



Python /Django Developer Role, London, UK

2012-10-03 Thread Paul Canal
We are hiring Python / Django Developers for our Education Business in East 
London.   Interesting role in friendly SME developing / extending existing 
Python application. paul.ca...@gmail.com  www.idxtra.com 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/0C9cDbBrWvYJ.
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 translate Lookup values in Django?

2012-10-03 Thread Juan Pablo Martínez
Then you could come here and test if it's

https://github.com/juanpex/django-model-i18n/

Regards,

On Tue, Oct 2, 2012 at 10:08 PM, Houman  wrote:

> Thanks Juan.
>
> Well that is certainly possible. But then we have also some other lookups
> like the country, which is a lookup of 139 values. It would be difficult to
> keep that in the model itself. ;-)
> But you are right about smaller lookups.
>
> Regards,
> Houman
>
> On 3 Oct 2012, at 01:57, Juan Pablo Martínez  wrote:
>
> GENDER_CHOICES = (
> ('male', _(u'Male')),
> ('female', _(u'Female')),
> )
> gender   = models.CharField(_(u'Sex'), max_length=10, 
> choices=GENDER_CHOICES)
>
>
>
> On Tue, Oct 2, 2012 at 7:23 PM, Houmie  wrote:
>
>>  Django has an excellent support for internationalization, any English
>> expression within Models, Forms, View or template can easily be marked for
>> translation. However I came across an interesting situation I don't know
>> how to deal with.
>>
>> I have a Gender lookup (Male, Female). Now even if I translated the site
>> into German, the Gender dropdown is still pointing to the values saved in
>> database, which happens to be in English. So How am I supposed to mark the
>> values in the database to be translated in PO files?
>>
>> class Gender(models.Model):
>> gender   = models.CharField(_(u'Sex'), max_length=10)
>>
>>
>>
>> def __unicode__(self):
>> return self.gender
>> class Meta:
>>
>>
>>
>> verbose_name = _(u'Sex')
>> verbose_name_plural = _(u'Sexes')
>>
>>
>>
>> Many Thanks,
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/mLjpKAPU1NAJ.
>> 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.
>>
>
>
>
> --
> juanpex
>
>  --
> 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.
>



-- 
juanpex

-- 
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: send_mail on MAC OS X 10.7

2012-10-03 Thread Tom Evans
On Wed, Oct 3, 2012 at 2:39 PM, Cheng  wrote:
> Hi Dennis,
>
> I am not familiar with setting up the Mac. How do I check the STMP service
> on the Mac?
>
> I am able to send email through the Mac's Mail application though. The
> outgoing mail server for the Mail application is smtp.googlemail.com. The
> incoming mail server for the Mail application is imap.googlemail.com.
>
> Thanks,
> Cheng

If you know the right SMTP server to use, then simply configure django
to use it:

https://docs.djangoproject.com/en/1.4/ref/settings/#email-host

Cheers

Tom

-- 
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: Invalidating active sessions after a password change?

2012-10-03 Thread Dirley
So, thank you for the insights. I ended up with a solution that is a mix of
what you've proposed here.

Each time a user logs in, it's current *session validation token* is saved on
the session. It is easy to code this using the `user_logged_in` signal.

Then, I've changed the logic of the code that extracts the *authenticated user*
from the session. Now, it extracts the user and checks its token. If the token
doesn't match or is missing, the session is flushed (maybe it should be
deleted?) and the user is replaced by an instance of `AnonymousUser`.

The only thing not defined here is how to calculate the token. I'm currently
calculating it based on the user password, so when the user changes it's
password, the token is automatically refreshed. A more adequate approach would
be to save that token on an attribute of the user model or something, making it
optional to refresh the token or not (like Facebook does it).

An example of this implementation is available here:

  http://pastebin.com/jASA4v6K

This is a quick and dirty solution. To use it, just call
`session_invalidation.setup` during the app boot (you can call it from inside
any installed app `models.py`). Note, though, that it does some things the
wrong way:

-  It monekypatches `d.c.auth.get_user` to change it's logic and do the
   token-checking magic. This is ok for a quick and dirty solution, but a more
   sophisticated code would do it differently, maybe through middlewares.

-  It calculates the token based on the user's current password. When the user
   changes it's password, all it's active sessions are automatically
   invalidated. Even the current one (the one where the password change was
   done). I've managed to avoid this problem by calling
   `session_invalidation.reset_session_validation_token` after changing the
   password change, so the current session doesn't get invalidated.

That's it. Thank you for the clues.


- D

-- 
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: Migrating a Django project to new platform

2012-10-03 Thread Elliot
Hi guys, thank you sincerely for your feedback.

As far as I know there is just the one instance of python installed:

"
>>> print sys.path
['', '/usr/lib/python2.4/site-packages/PIL-1.1.7-py2.4-linux-i686.egg', 
'/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg', 
'/usr/lib/python24.zip', '/usr/lib/python2.4', 
'/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', 
'/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages', 
'/usr/lib/python2.4/site-packages/Numeric', 
'/usr/lib/python2.4/site-packages/gtk-2.0']

[root@svr-h001463 hayley]# whereis python
python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 
/usr/include/python2.4 /usr/share/man/man1/python.1.gz

[root@svr-h001463 hayley]# cd /usr/lib
[root@svr-h001463 lib]# ls -d */ | grep "py"
pygtk/
python2.4/
"

If I try 'python manage.py shell':
"
[root@svr-h001463 hayley]# python manage.py shell
Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File 
"/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line 
301, in execute_manager
utility.execute()
  File 
"/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line 
248, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.4/site-packages/django/core/management/base.py", 
line 77, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.4/site-packages/django/core/management/base.py", 
line 86, in execute
translation.activate('en-us')
  File 
"/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py", 
line 73, in activate
return real_activate(language)
  File 
"/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py", 
line 43, in delayed_loader
return g['real_%s' % caller](*args, **kwargs)
  File 
"/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py", 
line 220, in activate
_active[currentThread()] = translation(language)
  File 
"/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py", 
line 209, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
  File 
"/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py", 
line 192, in _fetch
app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]), 
appname[p+1:])
  File 
"/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg/sorl/thumbnail/__init__.py",
 
line 1, in ?
from sorl.thumbnail.fields import ImageField
  File 
"/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg/sorl/thumbnail/fields.py",
 
line 61
with open(data.temporary_file_path(), 'rb') as fp:
^
SyntaxError: invalid syntax
"

It's going to take me a while to understand all that. This is likely the 
first time I've had to dig around python.

I'll follow up on your suggestions, but in the meantime, if any of the 
above throws any more light on the issue from your perspective, further 
comments would be appreciated :)

Thank you!

Elliot

On Wednesday, October 3, 2012 2:56:46 PM UTC+1, ke1g wrote:
>
> A bit of generic advice: 
>
> Be sure that you know which python is running your stuff: mod_wsgi, 
> and IIRC mod_python (if the site really uses it) are bound to a 
> specific python interpreter.  It may or may not be the one where you 
> installed sorl-thumbnail.  One question is whether the: 
>
> python manage.py shell 
>
> will start.  If that works, runserver (the development server will 
> probably work (I'm guessing that you've been testing via Apache).  If 
> so, then use the shell to pretty print sys.path, to find out where 
> that configuration is finding stuff: 
>
> from pprint import pprint 
> import sys 
> pprint(sys.path) 
>
> You can also write a trivial WSGI "application" (it's just a function) 
> that creates a text/plain response giving the same information for 
> that environment.  You can also capture sys.version to confirm that 
> both pythons are, say, a 2.7.x or not. 
>
> If both pythons are compatible versions (not, say, a 2.6 and a 2.7), 
> you may be able to fix things with the python-path argument to the 
> WSGIDaemonProcess directive (specific to the daemon process group) or 
> more globally by using a WSGIPythonHome or WSGIPythonPath directive. 
> But it is also possible to install stuff in the python that mod_wsgi 
> is using be default, and to arrange for any manage.py actions you need 
> to run with that python. 
>
> Bill 
>
> On Wed, Oct 3, 2012 at 7:51 AM, Elliot 
> > 
> wrote: 
> > Hi all, 
> > 
> > I would like some help or advice migrating an old Django project to a 
> > different platform. 
> > 
> > Firstly, I am ok-ish with linux (mainly CentOS), and created basic 
> websites, 
> > MySQL/PHP/HTML intranets, but know next to nothing about Django or CMS 
> > systems in general, so I appreciate that this is quite a challenge for 
> me! 
> > 
> > So, I have access to a Ubuntu 11 

Re: How to translate Lookup values in Django?

2012-10-03 Thread Jair Trejo
I use django-datatrans for catalog translation, i'ts not perfect but good 
enough for me.

El martes, 2 de octubre de 2012 20:09:46 UTC-5, Houmie escribió:
>
> Thanks Juan. 
>
> Well that is certainly possible. But then we have also some other lookups 
> like the country, which is a lookup of 139 values. It would be difficult to 
> keep that in the model itself. ;-)
> But you are right about smaller lookups.
>
> Regards,
> Houman
>
> On 3 Oct 2012, at 01:57, Juan Pablo Martínez > 
> wrote:
>
> GENDER_CHOICES = (
> ('male', _(u'Male')),
> ('female', _(u'Female')),
> )
> gender   = models.CharField(_(u'Sex'), max_length=10, 
> choices=GENDER_CHOICES)
>
>
>
> On Tue, Oct 2, 2012 at 7:23 PM, Houmie >wrote:
>
>>  Django has an excellent support for internationalization, any English 
>> expression within Models, Forms, View or template can easily be marked for 
>> translation. However I came across an interesting situation I don't know 
>> how to deal with.
>>
>> I have a Gender lookup (Male, Female). Now even if I translated the site 
>> into German, the Gender dropdown is still pointing to the values saved in 
>> database, which happens to be in English. So How am I supposed to mark the 
>> values in the database to be translated in PO files?
>>
>> class Gender(models.Model):
>> gender   = models.CharField(_(u'Sex'), max_length=10)
>>
>>
>> def __unicode__(self):
>> return self.gender
>> class Meta:
>>
>>
>> verbose_name = _(u'Sex')
>> verbose_name_plural = _(u'Sexes')
>>
>>  
>> Many Thanks,
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/mLjpKAPU1NAJ.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> juanpex
>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3U8FtzKa9IIJ.
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: Migrating a Django project to new platform

2012-10-03 Thread Cal Leeming [Simplicity Media Ltd]
The paste you gave us is python 2.4, very old!

My guess is that your old server is 2.4, and your new one is 2.6/2.7 - or
the other way around - that would explain the weirdness.

On your new/old server, paste us the result of just typing 'python' on its
own.

Cal

On Wed, Oct 3, 2012 at 4:31 PM, Elliot wrote:

> Hi guys, thank you sincerely for your feedback.
>
> As far as I know there is just the one instance of python installed:
>
> "
> >>> print sys.path
> ['', '/usr/lib/python2.4/site-packages/PIL-1.1.7-py2.4-linux-i686.egg',
> '/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg',
> '/usr/lib/python24.zip', '/usr/lib/python2.4',
> '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
> '/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages/Numeric',
> '/usr/lib/python2.4/site-packages/gtk-2.0']
>
> [root@svr-h001463 hayley]# whereis python
> python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4
> /usr/include/python2.4 /usr/share/man/man1/python.1.gz
>
> [root@svr-h001463 hayley]# cd /usr/lib
> [root@svr-h001463 lib]# ls -d */ | grep "py"
> pygtk/
> python2.4/
> "
>
> If I try 'python manage.py shell':
> "
> [root@svr-h001463 hayley]# python manage.py shell
> Traceback (most recent call last):
>   File "manage.py", line 11, in ?
> execute_manager(settings)
>   File
> "/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line
> 301, in execute_manager
> utility.execute()
>   File
> "/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line
> 248, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/lib/python2.4/site-packages/django/core/management/base.py",
> line 77, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "/usr/lib/python2.4/site-packages/django/core/management/base.py",
> line 86, in execute
> translation.activate('en-us')
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
> line 73, in activate
> return real_activate(language)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
> line 43, in delayed_loader
> return g['real_%s' % caller](*args, **kwargs)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
> line 220, in activate
> _active[currentThread()] = translation(language)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
> line 209, in translation
> default_translation = _fetch(settings.LANGUAGE_CODE)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
> line 192, in _fetch
> app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]),
> appname[p+1:])
>   File
> "/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg/sorl/thumbnail/__init__.py",
> line 1, in ?
> from sorl.thumbnail.fields import ImageField
>   File
> "/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg/sorl/thumbnail/fields.py",
> line 61
> with open(data.temporary_file_path(), 'rb') as fp:
> ^
> SyntaxError: invalid syntax
> "
>
> It's going to take me a while to understand all that. This is likely the
> first time I've had to dig around python.
>
> I'll follow up on your suggestions, but in the meantime, if any of the
> above throws any more light on the issue from your perspective, further
> comments would be appreciated :)
>
> Thank you!
>
> Elliot
>
>
> On Wednesday, October 3, 2012 2:56:46 PM UTC+1, ke1g wrote:
>
>> A bit of generic advice:
>>
>> Be sure that you know which python is running your stuff: mod_wsgi,
>> and IIRC mod_python (if the site really uses it) are bound to a
>> specific python interpreter.  It may or may not be the one where you
>> installed sorl-thumbnail.  One question is whether the:
>>
>> python manage.py shell
>>
>> will start.  If that works, runserver (the development server will
>> probably work (I'm guessing that you've been testing via Apache).  If
>> so, then use the shell to pretty print sys.path, to find out where
>> that configuration is finding stuff:
>>
>> from pprint import pprint
>> import sys
>> pprint(sys.path)
>>
>> You can also write a trivial WSGI "application" (it's just a function)
>> that creates a text/plain response giving the same information for
>> that environment.  You can also capture sys.version to confirm that
>> both pythons are, say, a 2.7.x or not.
>>
>> If both pythons are compatible versions (not, say, a 2.6 and a 2.7),
>> you may be able to fix things with the python-path argument to the
>> WSGIDaemonProcess directive (specific to the daemon process group) or
>> more globally by using a WSGIPythonHome or WSGIPythonPath directive.
>> But it is also possible to install stuff in the python that mod_wsgi
>> is using be default, and to arrange for any manage.py actions you need
>> to run with that python.
>>
>> Bill
>>
>> On We

Re: Migrating a Django project to new platform

2012-10-03 Thread Tom Evans
On Wed, Oct 3, 2012 at 4:31 PM, Elliot  wrote:
> Hi guys, thank you sincerely for your feedback.
>
> As far as I know there is just the one instance of python installed:
>
> "
 print sys.path
> ['', '/usr/lib/python2.4/site-packages/PIL-1.1.7-py2.4-linux-i686.egg',
> '/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg',
> '/usr/lib/python24.zip', '/usr/lib/python2.4',
> '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
> '/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages/Numeric',
> '/usr/lib/python2.4/site-packages/gtk-2.0']
>
> [root@svr-h001463 hayley]# whereis python
> python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4
> /usr/include/python2.4 /usr/share/man/man1/python.1.gz
>
> [root@svr-h001463 hayley]# cd /usr/lib
> [root@svr-h001463 lib]# ls -d */ | grep "py"
> pygtk/
> python2.4/
> "
>
> If I try 'python manage.py shell':
> "
> [root@svr-h001463 hayley]# python manage.py shell
> Traceback (most recent call last):
>   File "manage.py", line 11, in ?
> execute_manager(settings)
>   File
> "/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line
> 301, in execute_manager
> utility.execute()
>   File
> "/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line
> 248, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/lib/python2.4/site-packages/django/core/management/base.py",
> line 77, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "/usr/lib/python2.4/site-packages/django/core/management/base.py",
> line 86, in execute
> translation.activate('en-us')
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
> line 73, in activate
> return real_activate(language)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
> line 43, in delayed_loader
> return g['real_%s' % caller](*args, **kwargs)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
> line 220, in activate
> _active[currentThread()] = translation(language)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
> line 209, in translation
> default_translation = _fetch(settings.LANGUAGE_CODE)
>   File
> "/usr/lib/python2.4/site-packages/django/utils/translation/trans_real.py",
> line 192, in _fetch
> app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]),
> appname[p+1:])
>   File
> "/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg/sorl/thumbnail/__init__.py",
> line 1, in ?
> from sorl.thumbnail.fields import ImageField
>   File
> "/usr/lib/python2.4/site-packages/sorl_thumbnail-11.12-py2.4.egg/sorl/thumbnail/fields.py",
> line 61
> with open(data.temporary_file_path(), 'rb') as fp:
> ^
> SyntaxError: invalid syntax
> "

"with foo as bar" is a python 2.5 concept, so this version of
django-sorl is not compatible with 2.4. They almost certainly changed
it due to django itself no longer supporting python 2.4 after version
1.3.

When you installed the packages on the new box, I suspect
(particularly with packages you installed using easy_install) that you
have installed newer versions of those packages than existed on the
older box.

If you can start from scratch (!), I would start using the tool 'pip'
to discover what packages and versions you have on the old box, and
install exactly those versions on the new box. You may have to install
pip..

With pip installed, run "pip freeze" on the old box, which will output
a list of all packages available in the current environment. On the
new box, you can then run on the new box "pip install
sorl-thumbnail==3.2.5", or whatever version you require.

You might also want to look up virtualenv, which allows you to isolate
python packages per application, allowing different environments to
install different versions of the same package, and pip requirement
files, which allow you to specify all libraries that an application
needs to run. Combining the two gives you a simple file that defines
all the dependencies required by an app, and a tool that can take that
file and install them all into a disposable environment for the app -
in effect, consistent 1 step setup.

Cheers

Tom

-- 
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: send_mail on MAC OS X 10.7

2012-10-03 Thread Fred Stluka

Cheng,

Yeah, there's probably no need to be running sendmail on the Mac
if you only use it as a client machine, not a server that accepts
incoming mail requests from other machines.  Just configure Django
to use an SMTP server somewhere in the world that you have rights
to use, like smtp.googlemail.com as you do with your Apple Mail
client.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 10/3/12 10:09 AM, Tom Evans wrote:

On Wed, Oct 3, 2012 at 2:39 PM, Cheng  wrote:

Hi Dennis,

I am not familiar with setting up the Mac. How do I check the STMP service
on the Mac?

I am able to send email through the Mac's Mail application though. The
outgoing mail server for the Mail application is smtp.googlemail.com. The
incoming mail server for the Mail application is imap.googlemail.com.

Thanks,
Cheng

If you know the right SMTP server to use, then simply configure django
to use it:

https://docs.djangoproject.com/en/1.4/ref/settings/#email-host

Cheers

Tom



--
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 translate Lookup values in Django?

2012-10-03 Thread houmie
Thanks guys. I came across myself across django-modeltranslation and I 
must it works very well.




On 03/10/12 16:34, Jair Trejo wrote:
I use django-datatrans for catalog translation, i'ts not perfect but 
good enough for me.


El martes, 2 de octubre de 2012 20:09:46 UTC-5, Houmie escribió:

Thanks Juan.

Well that is certainly possible. But then we have also some other
lookups like the country, which is a lookup of 139 values. It
would be difficult to keep that in the model itself. ;-)
But you are right about smaller lookups.

Regards,
Houman

On 3 Oct 2012, at 01:57, Juan Pablo Martínez > wrote:


|GENDER_CHOICES = (
('male', _(u'Male')),
('female', _(u'Female')),
)
gender=  models.CharField(_(u'Sex'),  max_length=10, 
choices=GENDER_CHOICES)|


On Tue, Oct 2, 2012 at 7:23 PM, Houmie > wrote:

Django has an excellent support for internationalization, any
English expression within Models, Forms, View or template can
easily be marked for translation. However I came across an
interesting situation I don't know how to deal with.

I have a Gender lookup (Male, Female). Now even if I
translated the site into German, the Gender dropdown is still
pointing to the values saved in database, which happens to be
in English. So How am I supposed to mark the values in the
database to be translated in PO files?

|class  Gender(models.Model):
 gender=  models.CharField(_(u'Sex'),  max_length=10) 



 def  __unicode__(self):
 return  self.gender
 class  Meta:


 verbose_name=  _(u'Sex')
 verbose_name_plural=  _(u'Sexes')


|


Many Thanks,

-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/mLjpKAPU1NAJ
.
To post to this group, send email to
django...@googlegroups.com .
To unsubscribe from this group, send email to
django-users...@googlegroups.com .
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
.




-- 
juanpex


-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com
.
To unsubscribe from this group, send email to
django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3U8FtzKa9IIJ.

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: Autoescape of & char ignoring safe filter

2012-10-03 Thread Marc Serra
Laxmikant I think you didn't understand my point. I don't want it escaped, 
and escape marks it for escaping. I want to output the contents of database 
RAW, without escaping. Safe filter does this but I found the weird 
exception of &, what messes with urls with parameters on them.

Regards,
Marc Serra

El dimecres 3 d’octubre de 2012 6:25:38 UTC+2, Laxmikant Gurnalkar va 
escriure:
>
> >>>I have not used *safe*  ever. But use *escape* this works for me.
>
> On Wed, Oct 3, 2012 at 9:54 AM, Laxmikant Gurnalkar <
> laxmikant...@gmail.com > wrote:
>
>> Hi, 
>> I have not used *sace*  ever. But use *escape* this works for me.
>> https://docs.djangoproject.com/en/1.0/ref/templates/builtins/#escape
>>
>> Cheers
>> *Laxmikant G.*
>>
>>
>>
>> On Wed, Oct 3, 2012 at 4:06 AM, Marc Serra 
>> > wrote:
>>
>>> Hi, i'm trying to output raw html content form the database on the 
>>> website, so i use the safe filter on the variable. All html code is 
>>> displayed correctly except the ampersand that are escaped ignoring the safe 
>>> filter, or It seems to me.
>>>
>>> I also tried to use a templatetag  with the mark_safe function with the 
>>> same outcome.
>>>
>>> Here an example:
>>>
>>> Source in database:
>>>
>>> >> value="http://www.youtube.com/v/Uq8zzBW9hlc&hl=en&fs=1&hd=1";>>> name="allowFullScreen" value="true">>> value="always">>> src="http://www.youtube.com/v/Uq8zzBW9hlc&hl=en&fs=1&hd=1"; 
>>> type="application/x-shockwave-flash" allowscriptaccess="always" 
>>> allowfullscreen="true" width="560" height="340">
>>>
>>> On template with |safe filter (notice "&" replacement with "&"):
>>>
>>> >> value="http://www.youtube.com/v/Uq8zzBW9hlc&hl=en&fs=1&hd=1 
>>> ">>> name="allowFullScreen" value="true">>> value="always">>> src="http://www.youtube.com/v/Uq8zzBW9hlc&hl=en&fs=1&hd=1 
>>> " 
>>> type="application/x-shockwave-flash" allowscriptaccess="always" 
>>> allowfullscreen="true" height="340" width="560">
>>>
>>>
>>> You know what can be the reason to this behaviour and how to solve it?
>>>
>>> Thank you,
>>> Marc Serra
>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/django-users/-/M3FV3yY7JnoJ.
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to 
>>> django-users...@googlegroups.com .
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> -- 
>> * 
>>
>>  GlxGuru
>>
>> *
>>
>
>
>
> -- 
> * 
>
>  GlxGuru
>
> *
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Yau7wHup5JoJ.
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: Django by Example blog Tutorial

2012-10-03 Thread Tuss4
Thank you for your prompt response. I'll try out your edit. This is what my 
urlsl.py (in the blog folder) looks like:

urlpatterns = patterns('blog.views',
url(r'^', 'main'),
url(r'^(\d+)/$', 'post'),
url(r'^add_comment/(\d+)/$', 'add_comment'),
)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9TyEO4lEmqIJ.
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: Django by Example blog Tutorial

2012-10-03 Thread Tuss4
Still no difference. I'm starting to take there's something going on with 
views.py.

On Wednesday, October 3, 2012 12:45:31 PM UTC-5, Tuss4 wrote:
>
> Thank you for your prompt response. I'll try out your edit. This is what 
> my urlsl.py (in the blog folder) looks like:
>
> urlpatterns = patterns('blog.views',
> url(r'^', 'main'),
> url(r'^(\d+)/$', 'post'),
> url(r'^add_comment/(\d+)/$', 'add_comment'),
> )
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IygtQUjZYwwJ.
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 and multiprocessing.Pool.imap_unordered

2012-10-03 Thread nokk
Hi,

I am using Django and mod_wsgi:

I have Use Case that i need to check each item on a list, the point is I am 
interesting in the item that result True - once I have it I don't care for 
the others (only one can be True), and i want to return it to the client - 
so I want to use imap_unordered - but when I do it, Django just hangs on 
the HttpResponse for couple of seconds and then return 200 whit out body.

is there a way so it will work?

thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3MnJjyAqzt8J.
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: sqlite datetime issue with django

2012-10-03 Thread puneet loya
Thank you :) Will check that :)

On Wed, Sep 26, 2012 at 12:35 AM, Bill Freeman  wrote:

> When django reads the data back, does it reconvert it to your
> timezone?  If so, why is it a problem that it is stored as UTC in the
> database?
>
> On Tue, Sep 25, 2012 at 2:19 PM, puneet loya  wrote:
> > Hi,
> >
> > I m having problems with sqlite insertion.
> >
> > When i enter datetime object using django into sqlite, sqlite is
> converting
> > the datetime to UTC and storing it. Hence the datetime inserted in the
> > sqlite db is incorrect.
> >
> > My timezone in UTC+05:30 and the datetime inserted is in UTC.
> >
> >
> > Any suggestions??
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/98E6x3lnvtwJ.
> > 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.



Like a Formset but not...

2012-10-03 Thread Lachlan Musicman
Hi,

I am looking for a way to do something similar to a formset, but
slightly different.

I have a list of students in a class (class as a school subject, not
class in programming) with attendance record objects having a FK to
both student and class, as well as two fields with choices lists
relating to attendance (present, absent | reasons for absence)

What I want is an uneditable list of students on a page, and next to
each student a RadioSelect widget for each of the fields relating to
attendance.

I successfully created a page with formsets listing all the attendance
records for a class, and excluded the unnecessary fields - but this
means that the student FK field is rendered as a drop down list of all
students - ie, it's editable. (as a side note, each record in the
formset is not followed by a line break, making the output ugly. I
didn't expect that)

This is not the desired outcome.

I have thought about going pure views.py - creating a list of students
from the class object and cobbling together some html to add the two
attendance fields, potentially unlinked to the model itself, to render
the page via a table/divs, but am concerned about how stupidly complex
it could become for quite a simple problem, when taking into account
differing numbers of students, matching student names with the radio
buttons selected and using get_or_create()...

Is this via views.py the best method, or am I missing something obvious?

Cheers
L.

-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
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: EntryAdmin.form does not inherit from BaseModelForm.

2012-10-03 Thread Chris Fox
I have since upgraded to version 1.4.1 which has resolved this issue.

On Saturday, September 29, 2012 9:19:54 PM UTC-4, Chris Fox wrote:
>
> Hello,
>
> I'm having a strange issue where I get the following exception on my 
> production server, but have no issues on my dev machine:
>
> Django Version:1.3.1Exception Type:ImproperlyConfiguredException Value:
>
> EntryAdmin.form does not inherit from BaseModelForm.
>
> Exception 
> Location:/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py
>  
> in validate_base, line 292Python Executable:/usr/local/bin/pythonPython 
> Version:2.7.3
>
> I have narrowed the problem down to this area of the code:
>
> class EntryAdminForm(forms.ModelForm):
> class Meta:
> model = Entry
>
> latitude = CoordinateField()
> longitude = CoordinateField()
>
> class EntryAdmin(admin.ModelAdmin):
> form = EntryAdminForm  ## COMMENT OUT THIS LINE MAKES THE PRODUCTION 
> SERVER WORK ##
> list_display = ('title', 'location', 'pub_date', 'type', 'blogger')
> list_filter = ('blogger', 'pub_date', 'type')
>
> I have hit a wall with this one and could use some inspiration. 
> As mentioned above commenting out form = EntryAdminForm in EntryAdmin 
> makes everything work fine
>
> Below is more details on the error:
> Environment:
>
>
> Request Method: GET
> Request URL: http://URL/admin/sail_blog/entry/120/
>
> Django Version: 1.3.1
> Python Version: 2.7.3
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin',
>  'sail_blog',
>  'blog_redirect']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Traceback:
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/core/handlers/base.py" in 
> get_response
>   101. request.path_info)
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in 
> resolve
>   250. for pattern in self.url_patterns:
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in 
> _get_url_patterns
>   279. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in 
> _get_urlconf_module
>   274. self._urlconf_module = import_module(self.urlconf_name)
> File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" 
> in import_module
>   35. __import__(name)
> File "/home/cjfox/webapps/django_1_3_1/starship/urls.py" in 
>   5. admin.autodiscover()
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/__init__.py" 
> in autodiscover
>   26. import_module('%s.admin' % app)
> File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" 
> in import_module
>   35. __import__(name)
> File "/home/cjfox/webapps/django_1_3_1/starship/sail_blog/admin.py" in 
> 
>   45. admin.site.register(Entry, EntryAdmin)
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/sites.py" 
> in register
>   97. validate(admin_class, model)
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py"
>  
> in validate
>   24. validate_base(cls, model)
> File 
> "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py"
>  
> in validate_base
>   292. "BaseModelForm." % cls.__name__)
>
> Exception Type: ImproperlyConfigured at /admin/sail_blog/entry/120/
> Exception Value: EntryAdmin.form does not inherit from BaseModelForm.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/YStvi_I6AEUJ.
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.



Inlines defined before use?

2012-10-03 Thread Lachlan Musicman
Hola,

I'm finding that if my inlines aren't defined before use in the
admin.py, I'm getting the following errors:

inlines=('MyModelInline',)
"issubclass() arg 1 must be a class" Errors

inlines=(MyModelInline,)
"name 'MyModelInline' is not defined"

This is a minor issue, easily solved by putting the inlines at the top
of the admin.py

Is this meant to be how it works?

cheers
L.

-- 
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
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.



assign media to models

2012-10-03 Thread winniehell
Hi list!

I have different models with uploaded content. So I made a Media model
with a primary key to ContentType to distinguish to which kind of models
the media belongs. Now I want to upload the media inline instead of
having to add a Media instance first. Can anybody give me a hint how to
do this?

Thanks,
Winnie

-- 
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: Autoescape of & char ignoring safe filter

2012-10-03 Thread Russell Keith-Magee
On Thu, Oct 4, 2012 at 1:17 AM, Marc Serra  wrote:
> Laxmikant I think you didn't understand my point. I don't want it escaped,
> and escape marks it for escaping. I want to output the contents of database
> RAW, without escaping. Safe filter does this but I found the weird exception
> of &, what messes with urls with parameters on them.

Are you *absolutely* certain that the database contains & and not
&? How are you verifying that this is what the database contains?
The reason I ask is that |safe is essentially a call to Django that
says "don't do anything", so I don't see how the behaviour you
describe could be caused.

Also - are you sure that there isn't anything else in your pipeline
between the database and your display? If part of the content is being
transformed, it has all the hallmarks of something being double
handled.

Yours,
Russ Magee %-)

-- 
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.



Why do the fastcgi instructions for Apache include a RewriteCond for file existance?

2012-10-03 Thread Dino Viehland
Looking at the instructions for how to use Django w/ shared hosting via 
FastCGI at 
https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
 
it includes this line:

RewriteCond %{REQUEST_FILENAME} !-f

That will cause the web server to not re-write the URL if the request is for a 
file which exists.  It seems like that will mean that 
random files which are mixed in with the Django app's source code could be 
served up if the user can guess the URL.  But that
seems to conflict with the advice for serving static files over here: 
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#serving-files

Searching around for Django RewriteRule I can see other people have posted how 
to set this up
but they haven't included this line.  So does anyone know why this line is 
included in the official 
documentation?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SMVfwT7VLYAJ.
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.



Bug with collapse fieldsets?

2012-10-03 Thread Janusz Jaworski
Hello. I found probably a little bug or it's just a feature (dunno). But my 
question is why i can't unhide collapsed fields when i use 'None' for name 
of group and use 'collapse' in dictionary in fieldsets. Here is the line of 
code and screens:  

fieldsets = [(None, {'fields': (('title', 'slug', 'category'),), 
'classes':('collapse',),}), ...] and screens: first is when i use 'None' - 
http://i49.tinypic.com/b88pxg.png and second is when i use name "Example" 
for subgroup of fields - http://i50.tinypic.com/140lvg5.png . As you can 
see subgroup with 'None' and collapse turned on can't unhide cause there is 
just line with no button :( Sorry for my poor language. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/RhQm2vz79owJ.
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: Autoescape of & char ignoring safe filter

2012-10-03 Thread Marc Serra
I've checked the database contents with sqliteman and the ampersands are 
ok, not escaped. Also i've checked the value retrieved of the database with 
a custom template tag and logging the value just before sending it to 
template, just before sending the data to the template it's correct. 
Finally checked again with shell and it's showing on console the expected 
output, all seems ok until the result is processed on the template.

On your second remark, i'm sorry but i'm quite new on django i'm not sure 
how to check the pipeline process, I'll put here the variables on settings 
I think can alter the functionality of django:

 MIDDLEWARE_CLASSES = (

'django.middleware.common.CommonMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

# Uncomment the next line for simple clickjacking protection:

# 'django.middleware.clickjacking.XFrameOptionsMiddleware',

)

TEMPLATE_CONTEXT_PROCESSORS = (

'django.contrib.auth.context_processors.auth',

'django.core.context_processors.i18n',

'django.core.context_processors.request',

'django.core.context_processors.media',

'django.core.context_processors.static',

)

I've tried disabling all TEMPLATE_CONTEXT_PROCESSORS (except auth, needed 
by admin interface) and MIDDLEWARE_CLASSES with no success.

Can you point me something else I can or should check?

Regards,
Marc Serra


El dijous 4 d’octubre de 2012 1:28:23 UTC+2, Russell Keith-Magee va 
escriure:
>
> On Thu, Oct 4, 2012 at 1:17 AM, Marc Serra > 
> wrote: 
> > Laxmikant I think you didn't understand my point. I don't want it 
> escaped, 
> > and escape marks it for escaping. I want to output the contents of 
> database 
> > RAW, without escaping. Safe filter does this but I found the weird 
> exception 
> > of &, what messes with urls with parameters on them. 
>
> Are you *absolutely* certain that the database contains & and not 
> &? How are you verifying that this is what the database contains? 
> The reason I ask is that |safe is essentially a call to Django that 
> says "don't do anything", so I don't see how the behaviour you 
> describe could be caused. 
>
> Also - are you sure that there isn't anything else in your pipeline 
> between the database and your display? If part of the content is being 
> transformed, it has all the hallmarks of something being double 
> handled. 
>
> Yours, 
> Russ Magee %-) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/a4AocuofZF8J.
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: Bug with collapse fieldsets?

2012-10-03 Thread Laxmikant Gurnalkar
What do you expect from None?


On Thu, Oct 4, 2012 at 4:02 AM, Janusz Jaworski  wrote:

> Hello. I found probably a little bug or it's just a feature (dunno). But
> my question is why i can't unhide collapsed fields when i use 'None' for
> name of group and use 'collapse' in dictionary in fieldsets. Here is the
> line of code and screens:
>
> fieldsets = [(None, {'fields': (('title', 'slug', 'category'),),
> 'classes':('collapse',),}), ...] and screens: first is when i use 'None' -
> http://i49.tinypic.com/b88pxg.png and second is when i use name "Example"
> for subgroup of fields - http://i50.tinypic.com/140lvg5.png . As you can
> see subgroup with 'None' and collapse turned on can't unhide cause there is
> just line with no button :( Sorry for my poor language.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/RhQm2vz79owJ.
> 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.
>



-- 
*

 GlxGuru

*

-- 
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.