Re: YUI file upload and form errors

2008-01-02 Thread Malcolm Tredinnick


On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
[...]
> As an example, the JSON response seen by the javascript might be:
> 
>"{\"valid\": false, \"errors\": {\"options\": \"ul class=\
> \"errorlist\\"liThis field is required.\/li\/
> ul\"}}"
> 
> when it should be:
> 
>"{\"valid\": false, \"errors\": {\"options\": \" \"errorlist\\">This field is required.<\/li><\/ul>\"}}"
> 
> You can see that the Django system encapsulates the entire response in
>  tags. Additionally, the underlying error message HTML is
> also escaped.

You might want to double-check that you're debugging the correct
problem. There is no code in Django that is adding the "pre" tags here.
The only occurrence of the string "

Re: YUI file upload and form errors

2008-01-02 Thread grahamu


On Jan 2, 7:13 pm, grahamu <[EMAIL PROTECTED]> wrote:
> > On Jan 2, 4:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
> > > > Hi,
> > > > I'm having a problem with Django "HTML escaping" JSON data sent in
> > > > response to an asynchronous form submission when the form has an
> > > >  field. Forms that don't have a file field
> > > > yield proper responses, and when Javascript is disabled on the browser
> > > > normal form submissions work as well.
>
> > > > I'm using the Yahoo User Interface library, specifically the Dialog &
> > > > Connection Manager components, to send and receive asynchronous
> > > > messages to/from my view.
>
> > > > As an example, the JSON response seen by the javascript might be:
>
> > > >"{\"valid\": false, \"errors\": {\"options\": \"ul class=\
> > > > \"errorlist\\"liThis field is required.\/li\/
> > > > ul\"}}"
>
> > > > when it should be:
>
> > > >"{\"valid\": false, \"errors\": {\"options\": \" > > > \"errorlist\\">This field is required.<\/li><\/ul>\"}}"
>
> > > > You can see that the Django system encapsulates the entire response in
> > > >  tags. Additionally, the underlying error message HTML is
> > > > also escaped.
>
> > > > Does anyone know why this escaping might be happening? Can you suggest
> > > > how I might avoid the escaping of the response?
>
> > > Both the "why" and the "how" are documented in docs/templates_python.txt
> > > in the source. The short answer is that any time a variable is rendered
> > > into a template auto-escaping is applied. If you don't want this to
> > > happen, you can mark the particular variable as safe from further
> > > escaping using either mark_safe() in your view (probably the best
> > > approach -- marking it safe as soon as you know that fact) or in the
> > > template with the "safe" filter ({{ some_var|safe }}) or wrap an entire
> > > section of the template within the {% autoescape off %} ... {%
> > > endautoescape %} template tag.
>
> > > Regards,
> > > Malcolm
>
> > > --
> > > A conclusion is the place where you got tired of 
> > > thinking.http://www.pointy-stick.com/blog/
>
> > Malcom,
> > Thanks for your speedy response. I don't believe this is a template
> > issue as I'm returning a JSON response and not rendering to a
> > template.
>
> > The view code logic:
>
> >if not form.is_valid():
> >   return JSONFormErrors(form)
> >else:
> >   # return some other data
>
> > and:
>
> >def JSONFormErrors(form):
> >   errors = form.errors
> >   response_dict = {}
> >   response_dict.update({'valid': not errors})
> >   response_dict.update({'errors': errors})
> >   return JsonResponse(response_dict)
>
> >class JsonResponse(HttpResponse):
> >   def __init__(self, data):
> >  HttpResponse.__init__(self, json_encode(data),
> > mimetype='application/javascript')
>
> > json_encode is a version of Wolfgang Kriesing's encoder (http://
> > dpaste.com/hold/25654/).
>
> Just to be clear, the encoding problem _does not_ occur when the form
> does not have an  field. Form errors are returned
> in the JSON string in perfect form, no HTML escaping happens. And the
> view logic (code path) is identical whether or not a file input field
> is present in the form.
> Graham

I tried marking all error strings as safe...

def JSONFormErrors(form):
from django.utils.safestring import mark_safe
errors = form.errors

# mark each value (string) in the error dictionary as safe
for key in errors:
mark_safe(errors[key])

response_dict = {}
response_dict.update({'valid': not errors})
response_dict.update({'errors': errors})
return = JsonResponse(response_dict)

...but that had no effect. Debugging this is tough, I can't seem to
find the code which is escaping the output. If I can find that perhaps
I can determine why it is getting escaped.

Any ideas?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sitemaps for subdomains

2008-01-02 Thread omat

You were right Peter, Google refused the subdomains, even when the
sitemap file was under "domain.com".

But this doesn't seem logical. If a sitemap can represent sub
directories, it should be able to represent sub domains below it
hierarchically.

Thanks for the reply...





On Jan 2, 11:15 pm, omat <[EMAIL PROTECTED]> wrote:
> The sitemaps.org says:
>
> > For instance, if the Sitemap is located 
> > athttp://www.example.com/sitemap.xml, it can't include URLs 
> > fromhttp://subdomain.example.com.
>
> But if I place it under "example.com" (without the "www") it should be
> ok for the subdomains.
>
> On Jan 2, 5:55 pm, Peter Rowell <[EMAIL PROTECTED]> wrote:
>
> > > How can I add URLs with sub-domains to my sitemap files?
>
> > If you are talking about XML sitemaps, you can't.
>
> > Fromhttp://www.sitemaps.org/protocol.php:
>
> > Note that this means that all URLs listed in the Sitemap must use the
> > same protocol (http, in this example) and reside on the same host as
> > the Sitemap. For instance, if the Sitemap is located 
> > athttp://www.example.com/sitemap.xml, it can't include URLs 
> > fromhttp://subdomain.example.com.
>
> > As the Emperor said, "Well, there it is."
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: loaddata problem with boolean null in fixture - anyone seen this?

2008-01-02 Thread Shev

It turns out this problem has been reported by others, see ticket
http://code.djangoproject.com/ticket/5563

The easiest solution in this case was to change the type of the field,
from models.BooleanField to models.NullBooleanField, and now null
values from the dumpdata are loaded without a problem.


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



Re: sitemaps for subdomains

2008-01-02 Thread omat

The sitemaps.org says:

> For instance, if the Sitemap is located at 
> http://www.example.com/sitemap.xml, it can't include URLs from 
> http://subdomain.example.com.

But if I place it under "example.com" (without the "www") it should be
ok for the subdomains.



On Jan 2, 5:55 pm, Peter Rowell <[EMAIL PROTECTED]> wrote:
> > How can I add URLs with sub-domains to my sitemap files?
>
> If you are talking about XML sitemaps, you can't.
>
> Fromhttp://www.sitemaps.org/protocol.php:
>
> Note that this means that all URLs listed in the Sitemap must use the
> same protocol (http, in this example) and reside on the same host as
> the Sitemap. For instance, if the Sitemap is located 
> athttp://www.example.com/sitemap.xml, it can't include URLs 
> fromhttp://subdomain.example.com.
>
> As the Emperor said, "Well, there it is."
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



render xml component in container

2008-01-02 Thread Tiger Uppercut
Hi,

I'm looking for the most pythonic [or djangonautic] way to render a
FusionChart [http://www.fusioncharts.com/gadgets/docs/] in Django.  I
searched through the forums and didn't see this addressed directly -- my
apologies if this is very basic and obvious!

1. I have a django template, container.html:

{% block head %}

{% endblock head %}

{% block main_content %}
 
The chart will appear within this DIV. This text will be replaced by
the chart.
 
 

var myChart = new
FusionCharts("/site_media/swf/Charts/HLinearGauge.swf", "myChartId", "400",
"200", "0", "0");

myChart.setDataXML("your_data.xml");

myChart.render("chartdiv");

 
{% endblock main_content %}


2. your_data.xml is also a django template, stored in
myapp/templates/you/your_data.xml, and the TEMPLATE_DIRS setting includes
myapp/template


   
  
  
  
   
   
  
   



3. I have a view --- def your_data(request).  I want this view to
a) populate the your.value object in the xml template -- your_data.xml
b) render the containing template, container.html.

Any suggestions on the best approach for this ... ?

Thanks!

TU

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



Re: How do I connect to development server with my browser?

2008-01-02 Thread Peter Rowell

> If I run the dev server briefly, that won't cause any problems, will it?

It all depends on your hosting company. When in doubt, ask. It's not
that you are port-scanning their accounting machine, but you are
creating a "long running process" (i.e. it doesn't just generate a
page and exit) that is listening on port . Many of them don't like
that.

My situation was completely avoidable because (Doh!) I have a Linux
server running in the garage. I just happened to be logged in to
1and1.com and I wasn't thinking. Bam! Locked out for 24 hours.

I like the suggestion of running this locally on your desktop/laptop,
at least until you are doing something more serious than the tutorial.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How do I connect to development server with my browser?

2008-01-02 Thread Keith

Wow! Thanks for all the replies. I appreciate all the help.

I'll check out the tutorial, and hope all goes well with the new baby.

The server is shared. My son doesn't have any problem with me working
on it, but I don't want to cause any problems for him. If I run the
dev server briefly, that won't cause any problems, will it?

I've downloaded the portable django software.

Thanks again, all.

Keith


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



Re: Views, Templates, and Dictionaries

2008-01-02 Thread brandonl

Thanks.

On Jan 2, 8:47 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> From the template docs:http://www.djangoproject.com/documentation/templates/
>
> {% for key, value in data.items %}
> {{ key }}: {{ value }}
> {% endfor %}
>
> Note that this is for the svn version of django.
>
> brandonl wrote:
> > I have a simple view:
>
> > def index(request):
> > this_dict = { 'one':'','two':'', 'three':''}
> > c = Context({"this_dict":this_dict})
> > return HttpResponse(t.render(c))
>
> > my template is like so:
>
> > {% for i in this_dict %}
> > key: {{i}} 
> > value:{{this_dict.i}} 
> > {% endfor %}
>
> > When the view is rendered it only prints the dictionary keys and not
> > the values:
>
> > key: one
> > value:
> > key:two
> > value:
> > key:three
> > value:
>
> > What am I doing wrong here?  Any help would be greatly appreciated.
> > Thanks.
>
> > - Brandon
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Views, Templates, and Dictionaries

2008-01-02 Thread Jeff Anderson

>From the template docs:
http://www.djangoproject.com/documentation/templates/

{% for key, value in data.items %}
{{ key }}: {{ value }}
{% endfor %}

Note that this is for the svn version of django.


brandonl wrote:
> I have a simple view:
>
> def index(request):
> this_dict = { 'one':'','two':'', 'three':''}
> c = Context({"this_dict":this_dict})
> return HttpResponse(t.render(c))
>
> my template is like so:
>
> {% for i in this_dict %}
> key: {{i}} 
> value:{{this_dict.i}} 
> {% endfor %}
>
> When the view is rendered it only prints the dictionary keys and not
> the values:
>
> key: one
> value:
> key:two
> value:
> key:three
> value:
>
> What am I doing wrong here?  Any help would be greatly appreciated.
> Thanks.
>
> - Brandon
>
> >
>   


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



Re: Views, Templates, and Dictionaries

2008-01-02 Thread William Siegrist

This might help...

from:  http://www.djangoproject.com/documentation/templates/#for

{% for key, value in this_dict.items %}
{{ key }}: {{ value }}
{% endfor %}

-Bill

On Jan 2, 2008, at 8:40 PM, brandonl wrote:



I have a simple view:

def index(request):
this_dict = { 'one':'','two':'', 'three':''}
c = Context({"this_dict":this_dict})
return HttpResponse(t.render(c))

my template is like so:

{% for i in this_dict %}
   key: {{i}} 
   value:{{this_dict.i}} 
{% endfor %}

When the view is rendered it only prints the dictionary keys and not
the values:

key: one
value:
key:two
value:
key:three
value:

What am I doing wrong here?  Any help would be greatly appreciated.
Thanks.

- Brandon

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









smime.p7s
Description: S/MIME cryptographic signature


Views, Templates, and Dictionaries

2008-01-02 Thread brandonl

I have a simple view:

def index(request):
this_dict = { 'one':'','two':'', 'three':''}
c = Context({"this_dict":this_dict})
return HttpResponse(t.render(c))

my template is like so:

{% for i in this_dict %}
key: {{i}} 
value:{{this_dict.i}} 
{% endfor %}

When the view is rendered it only prints the dictionary keys and not
the values:

key: one
value:
key:two
value:
key:three
value:

What am I doing wrong here?  Any help would be greatly appreciated.
Thanks.

- Brandon

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



Re: Is GeoDjango stable.

2008-01-02 Thread Justin Bronn

Generally, GeoDjango is as stable as trunk (the latest merge was today
-- we're in sync up to r6990).  This topic was discussed in-depth in a
previous thread:

http://groups.google.com/group/django-users/browse_thread/thread/f6d73b6ec1be2f03

> I took a look at the revisions and it seems to be updated from trunk, but 
> from my
> understanding its not exactly stable?

I'm aware that GeoDjango's installation requirements are burdensome,
however, this should not be confused with "instability."  The current
installation situation should improve as binary packages for GEOS 3.0
and GDAL 1.5 become more readily available.

Best Regards,
-Justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: put tagging in c:/python25/lib/, how to load it in template?

2008-01-02 Thread [EMAIL PROTECTED]

thanks Karen, it works as you said.

On Jan 3, 11:42 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Jan 2, 2008 10:34 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > i use {% load tagging.templatetags.tagging_tags %}, it work right on
> > the previous svn django.
>
> > last night i updated django to the latest svn, and got this error:
>
> > 'tagging.templatetags.tagging_tags' is not a valid tag library: Could
> > not load template library from
> > django.templatetags.tagging.templatetags.tagging_tags, No module named
> > tagging.templatetags.tagging_tags
>
> > i found this issue metion here:
>
> >http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Templ...
>
> > but i cannot find the way how to change {% load
> > tagging.templatetags.tagging_tags %} to the right way.
>
> > can someone help me, thanks!
>
> The note you point to says "Previously, anything before the final dot was
> ignored."  Therefore I would think what you need to do to make it work now
> is remove everything that used to be ignored:
>
> {% load tagging_tags %}
>
> Does that not work?
>
> Karen- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: put tagging in c:/python25/lib/, how to load it in template?

2008-01-02 Thread Karen Tracey
On Jan 2, 2008 10:34 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>
> i use {% load tagging.templatetags.tagging_tags %}, it work right on
> the previous svn django.
>
> last night i updated django to the latest svn, and got this error:
>
> 'tagging.templatetags.tagging_tags' is not a valid tag library: Could
> not load template library from
> django.templatetags.tagging.templatetags.tagging_tags, No module named
> tagging.templatetags.tagging_tags
>
> i found this issue metion here:
>
>
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Templatetagloadingrespectsdottednotation
>
> but i cannot find the way how to change {% load
> tagging.templatetags.tagging_tags %} to the right way.
>
> can someone help me, thanks!


The note you point to says "Previously, anything before the final dot was
ignored."  Therefore I would think what you need to do to make it work now
is remove everything that used to be ignored:

{% load tagging_tags %}

Does that not work?

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



put tagging in c:/python25/lib/, how to load it in template?

2008-01-02 Thread [EMAIL PROTECTED]

i use {% load tagging.templatetags.tagging_tags %}, it work right on
the previous svn django.

last night i updated django to the latest svn, and got this error:

'tagging.templatetags.tagging_tags' is not a valid tag library: Could
not load template library from
django.templatetags.tagging.templatetags.tagging_tags, No module named
tagging.templatetags.tagging_tags

i found this issue metion here:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Templatetagloadingrespectsdottednotation

but i cannot find the way how to change {% load
tagging.templatetags.tagging_tags %} to the right way.

can someone help me, thanks!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Printable article page URLs?

2008-01-02 Thread Tim Chase

> You could try not serving a different page at all: CSS can 
> apply a different stylesheet when printing than when on the
> screen. See http://www.alistapart.com/stories/goingtoprint/
> for an introduction.

While I agree with Ned that CSS is an excellent if not the
best way to go...The OP (Mordy) wrote

>>> Please don't suggest CSS, I know about it and it's not
>>> really an option for me.

:)

Another option I've used is to put the content-form in the
extension.  I can then serve the resource

http://example.com/foo

as

HTML -> http://example.com/foo.html
JSON -> http://example.com/foo.json
XML -> http://example.com/foo.xml
CSV -> http://example.com/foo.csv
tab-delimited -> http://example.com/foo.tab
plain-text -> http://example.com/foo.txt
PDF -> http://example.com/foo.pdf
SVG -> http://example.com/foo.svg

(I usually only implement HTML and a serialized format such
as JSON/XML/tab-delimited but the above shows the
flexibility of the scheme)

If the URI is a collection, then one can have /foos.
for represenations of the collection in  format and
then use /foos/my-foo-slug. for the contained
resources in their own flavor of format.

In the OP's case, printable versions can be URL'd as
http://example.com/foo.prn or
http://example.com/foo.prn.html or what have you.  Or maybe
use .xhtml for XHTML content, and .htm for a pre-CSS version
that would render nicely on printers and handhelds.  One
could even use an extension like .mobi or .wap for those
content types.

-tim



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



Re: update to the latest Django by svn, but serveral error comes...

2008-01-02 Thread [EMAIL PROTECTED]

thanks James, i found many changes in this file. it is very useful to
newbies.
here is from djangoproject.org:
Previously, anything before the final dot was ignored. If you were
using this for any decorative purpose (at least one package was, it
turns out), you have to remove any unwanted prefix.


1.  i have tagging in c:\python25\lib
2.  in settings.py INSTALLED_APPS = ('tagging', )
3.  in template file use  {% load tagging.templatetags.tagging_tags %}

what should i load? like  {% load templatetags.tagging_tags %} or  {%
load tagging_tags %}
they all did not work for me, the error as below:
'templatetags.tagging_tags' is not a valid tag library: Could not load
template library from django.templatetags.templatetags.tagging_tags,
No module named templatetags.tagging_tags

or should i put tagging into my project folder other than in python/
lib/ ?

thanks!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Is GeoDjango stable.

2008-01-02 Thread [EMAIL PROTECTED]

Greetings folks,

We are looking into using GeoDjango for a project of ours and are
wondering how stable it is compared to 0.9.6? I took a look at the
revisions and it seems to be updated from trunk, but from my
understanding its not exactly stable? Our requirements are very simple
as we want to record simple positions to be rendered on a google map,
we are using postgresql and maybe just storing positions as numbers is
a better option?

Regards,
Brent.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Printable article page URLs?

2008-01-02 Thread Ned Batchelder

I also like /articles/slug/print, in that print modifies the 
articles/slug url that precedes it.  Also, you can prevent robot 
spidering other ways than robots.txt.  A  tag in the served 
content can direct the robot as well: see http://www.robotstxt.org/meta.html

--Ned.
http://nedbatchelder.com

Mordy Ovits wrote:
> I really like Django's policy of readable URLs and one authoritative 
> page.  My question is how do I do printable versions of those nice 
> and authoritative urls?
>
> Say I have this:
> http://www.site.com/articles/slug
>
> I can think of two general ways:
> http://www.site.com/print_articles/slug
> http://www.site.com/articles/slug?page=print
>
> Each has issues.  The first one needs a robots.txt fix to prevent the 
> print versioned from being spidered, but at least it can be done.   
> The second one is not amenable to a robots.txt fix.  The second one 
> is also "ugly" in my subjective django-influenced opinion.
>
> So what do you folks suggest for printable versions of article pages?  
> Please don't suggest CSS, I know about it and it's not really an 
> option for me.
>
> Thanks,
> Mordy
>
>
> >
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com

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



Re: Templates with multiple repeating blocks

2008-01-02 Thread Peter Rowell

> Use the user defined inclusion template tag or {% include %} standard
> taghttp://www.djangoproject.com/documentation/templates_python/#inclusio...

@Alex: That's not what he was asking for. He wants to be able to have
multiple blocks with the same name in a parent template and have them
get the same replacement values from a child. The link was to a thread
from 2005 about this.

@Justin: The Django template system is deliberately weak. It is
focused on the non-programming designer. There are a number of things
that would "be nice" but which you can't do.

But don't despair! Django couldn't care less what templating system
you use. As long as a view returns an HttpResponse object, knock
yourself out. Use a different template system for each of your views!
Send out for pizza! What? Anyway, the Django templates are just one
way of doing it.

See http://www.djangosnippets.org/snippets/97/ for how to integrate
the mako and genshi systems with Django.

  Good luck.

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



Re: YUI file upload and form errors

2008-01-02 Thread grahamu

> On Jan 2, 4:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
> > > Hi,
> > > I'm having a problem with Django "HTML escaping" JSON data sent in
> > > response to an asynchronous form submission when the form has an
> > >  field. Forms that don't have a file field
> > > yield proper responses, and when Javascript is disabled on the browser
> > > normal form submissions work as well.
>
> > > I'm using the Yahoo User Interface library, specifically the Dialog &
> > > Connection Manager components, to send and receive asynchronous
> > > messages to/from my view.
>
> > > As an example, the JSON response seen by the javascript might be:
>
> > >"{\"valid\": false, \"errors\": {\"options\": \"ul class=\
> > > \"errorlist\\"liThis field is required.\/li\/
> > > ul\"}}"
>
> > > when it should be:
>
> > >"{\"valid\": false, \"errors\": {\"options\": \" > > \"errorlist\\">This field is required.<\/li><\/ul>\"}}"
>
> > > You can see that the Django system encapsulates the entire response in
> > >  tags. Additionally, the underlying error message HTML is
> > > also escaped.
>
> > > Does anyone know why this escaping might be happening? Can you suggest
> > > how I might avoid the escaping of the response?
>
> > Both the "why" and the "how" are documented in docs/templates_python.txt
> > in the source. The short answer is that any time a variable is rendered
> > into a template auto-escaping is applied. If you don't want this to
> > happen, you can mark the particular variable as safe from further
> > escaping using either mark_safe() in your view (probably the best
> > approach -- marking it safe as soon as you know that fact) or in the
> > template with the "safe" filter ({{ some_var|safe }}) or wrap an entire
> > section of the template within the {% autoescape off %} ... {%
> > endautoescape %} template tag.
>
> > Regards,
> > Malcolm
>
> > --
> > A conclusion is the place where you got tired of 
> > thinking.http://www.pointy-stick.com/blog/
>
> Malcom,
> Thanks for your speedy response. I don't believe this is a template
> issue as I'm returning a JSON response and not rendering to a
> template.
>
> The view code logic:
>
>if not form.is_valid():
>   return JSONFormErrors(form)
>else:
>   # return some other data
>
> and:
>
>def JSONFormErrors(form):
>   errors = form.errors
>   response_dict = {}
>   response_dict.update({'valid': not errors})
>   response_dict.update({'errors': errors})
>   return JsonResponse(response_dict)
>
>class JsonResponse(HttpResponse):
>   def __init__(self, data):
>  HttpResponse.__init__(self, json_encode(data),
> mimetype='application/javascript')
>
> json_encode is a version of Wolfgang Kriesing's encoder (http://
> dpaste.com/hold/25654/).

Just to be clear, the encoding problem _does not_ occur when the form
does not have an  field. Form errors are returned
in the JSON string in perfect form, no HTML escaping happens. And the
view logic (code path) is identical whether or not a file input field
is present in the form.
Graham

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



Re: sitemaps for subdomains

2008-01-02 Thread Peter Rowell

> How can I add URLs with sub-domains to my sitemap files?

If you are talking about XML sitemaps, you can't.

>From http://www.sitemaps.org/protocol.php:

Note that this means that all URLs listed in the Sitemap must use the
same protocol (http, in this example) and reside on the same host as
the Sitemap. For instance, if the Sitemap is located at
http://www.example.com/sitemap.xml, it can't include URLs from
http://subdomain.example.com.

As the Emperor said, "Well, there it is."

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



Re: Printable article page URLs?

2008-01-02 Thread Ned Batchelder
You could try not serving a different page at all: CSS can apply a 
different stylesheet when printing than when on the screen.  See 
http://www.alistapart.com/stories/goingtoprint/ for an introduction.

--Ned.
http://nedbatchelder.com

Alex Koshelev wrote:
> The second variant with GET query is the best. One resouce has one uri
> but with query you specify it's display properties.
>
> On 3 янв, 01:52, Mordy Ovits <[EMAIL PROTECTED]> wrote:
>   
>> I really like Django's policy of readable URLs and one authoritative
>> page.  My question is how do I do printable versions of those nice
>> and authoritative urls?
>>
>> Say I have this:http://www.site.com/articles/slug
>>
>> I can think of two general 
>> ways:http://www.site.com/print_articles/slughttp://www.site.com/articles/slug?page=print
>>
>> Each has issues.  The first one needs a robots.txt fix to prevent the
>> print versioned from being spidered, but at least it can be done.
>> The second one is not amenable to a robots.txt fix.  The second one
>> is also "ugly" in my subjective django-influenced opinion.
>>
>> So what do you folks suggest for printable versions of article pages?
>> Please don't suggest CSS, I know about it and it's not really an
>> option for me.
>>
>> Thanks,
>> Mordy
>> 
> >
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com


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



Re: YUI file upload and form errors

2008-01-02 Thread grahamu

On Jan 2, 4:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
> > Hi,
> > I'm having a problem with Django "HTML escaping" JSON data sent in
> > response to an asynchronous form submission when the form has an
> >  field. Forms that don't have a file field
> > yield proper responses, and when Javascript is disabled on the browser
> > normal form submissions work as well.
>
> > I'm using the Yahoo User Interface library, specifically the Dialog &
> > Connection Manager components, to send and receive asynchronous
> > messages to/from my view.
>
> > As an example, the JSON response seen by the javascript might be:
>
> >"{\"valid\": false, \"errors\": {\"options\": \"ul class=\
> > \"errorlist\\"liThis field is required.\/li\/
> > ul\"}}"
>
> > when it should be:
>
> >"{\"valid\": false, \"errors\": {\"options\": \" > \"errorlist\\">This field is required.<\/li><\/ul>\"}}"
>
> > You can see that the Django system encapsulates the entire response in
> >  tags. Additionally, the underlying error message HTML is
> > also escaped.
>
> > Does anyone know why this escaping might be happening? Can you suggest
> > how I might avoid the escaping of the response?
>
> Both the "why" and the "how" are documented in docs/templates_python.txt
> in the source. The short answer is that any time a variable is rendered
> into a template auto-escaping is applied. If you don't want this to
> happen, you can mark the particular variable as safe from further
> escaping using either mark_safe() in your view (probably the best
> approach -- marking it safe as soon as you know that fact) or in the
> template with the "safe" filter ({{ some_var|safe }}) or wrap an entire
> section of the template within the {% autoescape off %} ... {%
> endautoescape %} template tag.
>
> Regards,
> Malcolm
>
> --
> A conclusion is the place where you got tired of 
> thinking.http://www.pointy-stick.com/blog/

Malcom,
Thanks for your speedy response. I don't believe this is a template
issue as I'm returning a JSON response and not rendering to a
template.

The view code logic:

   if not form.is_valid():
  return JSONFormErrors(form)
   else:
  # return some other data

and:

   def JSONFormErrors(form):
  errors = form.errors
  response_dict = {}
  response_dict.update({'valid': not errors})
  response_dict.update({'errors': errors})
  return JsonResponse(response_dict)

   class JsonResponse(HttpResponse):
  def __init__(self, data):
 HttpResponse.__init__(self, json_encode(data),
mimetype='application/javascript')

json_encode is a version of Wolfgang Kriesing's encoder (http://
dpaste.com/hold/25654/).

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



admin urls in my own admin view

2008-01-02 Thread Nianbig

Hi

I´m building my own admin view... I have followed this tutorial:
http://www.djangobook.com/en/1.0/chapter17/. Everything works fine
except that all urls in the header, the "home" link, "change password"
link, "logout" link doesn't work for some reasen.

The home-link is linked to "/", not "/admin/".. and the others are
linked to "/admin/myownview/change_password/" and so on...

Any ideas? Thanks.

/Niklas

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



Re: sitemaps for subdomains

2008-01-02 Thread omat

Well, I figured out that overriding the "get_urls" method of the
Sitemap class solves the problem. But, remember to call the private
__get() method like _Sitemap__get() in your class.

Though, a cleaner solution is appreciated...



On Jan 2, 3:38 pm, omat <[EMAIL PROTECTED]> wrote:
> In my sitemap file, I want to include subdomain links such 
> as:http://user1.domain.com,http://user2.domain.com, ...
>
> But when I specify a URL in "location" method of the sitemap class, a
> "http://example.com; (or whatever is specified  in the sites contrib
> app) is prepended to the URL.
>
> Same with get_absolute_url, too.
>
> How can I add URLs with sub-domains to my sitemap files?
>
> Thanks,
> oMat
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread Peter Rowell

(This is hedronist in his disguise as himself, whatever that means.)

> www.mysite.com/sprint_cellular_M1000/

Ah, something specific. Of course, it doesn't look like what you first
posted, but I kind of suspected that. I'll say it one more time, if
you have a specific problem, then you need to specifically say what it
specifically is or people can't give you specific help. At least,
that's generally true. :-)

Still plugging away: by plugging that in to the previous pattern, we
get:

>>> import re
>>> x = 'sprint_cellular_M1000/'
>>> m = re.match(r'^(?P[\w-]+)_(?P[\w-]+)/$', x)
>>> print m.groupdict()
{'line': 'M1000', 'manufacturer': 'sprint_cellular'}

Which looks like it could work to me. Or did you want 'sprint',
'cellular', and 'M1000' as separate items? In which case, what's the
name for the third item? And why didn't you mention it in the first
place?

> From what I understand google will think that the second second
> example is more important than the first example because it's only one
> level from the root.
> Has anybody else heard of this?

Yeah, I have -- that and a whole lot more. The site I just finished
brought in a $500/hour SEO voodoo priest to design their "silos" and
it caused us to do handstands avoiding /class/id type URLs. I'm not
certain it makes any difference, but he must know something I don't in
order to get that billing rate. Maybe he convinces people that
'gullible' is not in the dictionary.


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



Re: YUI file upload and form errors

2008-01-02 Thread Malcolm Tredinnick


On Wed, 2008-01-02 at 15:38 -0800, grahamu wrote:
> Hi,
> I'm having a problem with Django "HTML escaping" JSON data sent in
> response to an asynchronous form submission when the form has an
>  field. Forms that don't have a file field
> yield proper responses, and when Javascript is disabled on the browser
> normal form submissions work as well.
> 
> I'm using the Yahoo User Interface library, specifically the Dialog &
> Connection Manager components, to send and receive asynchronous
> messages to/from my view.
> 
> As an example, the JSON response seen by the javascript might be:
> 
>"{\"valid\": false, \"errors\": {\"options\": \"ul class=\
> \"errorlist\\"liThis field is required.\/li\/
> ul\"}}"
> 
> when it should be:
> 
>"{\"valid\": false, \"errors\": {\"options\": \" \"errorlist\\">This field is required.<\/li><\/ul>\"}}"
> 
> You can see that the Django system encapsulates the entire response in
>  tags. Additionally, the underlying error message HTML is
> also escaped.
> 
> Does anyone know why this escaping might be happening? Can you suggest
> how I might avoid the escaping of the response?

Both the "why" and the "how" are documented in docs/templates_python.txt
in the source. The short answer is that any time a variable is rendered
into a template auto-escaping is applied. If you don't want this to
happen, you can mark the particular variable as safe from further
escaping using either mark_safe() in your view (probably the best
approach -- marking it safe as soon as you know that fact) or in the
template with the "safe" filter ({{ some_var|safe }}) or wrap an entire
section of the template within the {% autoescape off %} ... {%
endautoescape %} template tag.

Regards,
Malcolm

-- 
A conclusion is the place where you got tired of thinking. 
http://www.pointy-stick.com/blog/


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



sitemaps for subdomains

2008-01-02 Thread omat

In my sitemap file, I want to include subdomain links such as:
http://user1.domain.com, http://user2.domain.com, ...

But when I specify a URL in "location" method of the sitemap class, a
"http://example.com; (or whatever is specified  in the sites contrib
app) is prepended to the URL.

Same with get_absolute_url, too.

How can I add URLs with sub-domains to my sitemap files?


Thanks,
oMat
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



YUI file upload and form errors

2008-01-02 Thread grahamu

Hi,
I'm having a problem with Django "HTML escaping" JSON data sent in
response to an asynchronous form submission when the form has an
 field. Forms that don't have a file field
yield proper responses, and when Javascript is disabled on the browser
normal form submissions work as well.

I'm using the Yahoo User Interface library, specifically the Dialog &
Connection Manager components, to send and receive asynchronous
messages to/from my view.

As an example, the JSON response seen by the javascript might be:

   "{\"valid\": false, \"errors\": {\"options\": \"ul class=\
\"errorlist\\"liThis field is required.\/li\/
ul\"}}"

when it should be:

   "{\"valid\": false, \"errors\": {\"options\": \"This field is required.<\/li><\/ul>\"}}"

You can see that the Django system encapsulates the entire response in
 tags. Additionally, the underlying error message HTML is
also escaped.

Does anyone know why this escaping might be happening? Can you suggest
how I might avoid the escaping of the response?

Graham
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get knowledge about islam...

2008-01-02 Thread Max Sinelnikov
sorry for my last message.  We are meting new year in Russia

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



Re: Templates with multiple repeating blocks

2008-01-02 Thread Alex Koshelev

Use the user defined inclusion template tag or {% include %} standard
tag
http://www.djangoproject.com/documentation/templates_python/#inclusion-tags

On 3 янв, 01:52, stryderjzw <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have the same situation as a thread (http://groups.google.com/group/
> django-users/browse_thread/thread/2dbb2b7f01951a2/efbeb1f74be6e454?
> lnk=gst=multiple+template+block) started in 2005. The idea is that
> in my template, I want to use the same template block for both the
>  and  tags.
>
> I didn't seem to find any solutions for this. Has this been considered
> since 2005? If not, what's a good solution to solve this problem? I'm
> just duplicating this right now in my template.
>
> Thanks,
>
> Justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get knowledge about islam...

2008-01-02 Thread Max Sinelnikov
Йобаные клерики, идити в жопу. Я русский.  Мои предки  сделали Революцию, я
атеист, мне срать на ваше дебильное мнение о мире. Умрите, пожалуйста, сами,
не заставляйте тратить на вас патроны. Православные, католики, всякие прочие
идиоты идут вместе с вами к стенке. Вы идиоты и вы неизлечимы. Вы не нужны
человечеству.

On Dec 31, 2007 4:27 PM, Islam Message <[EMAIL PROTECTED]>
wrote:

> *Dear Sir/Madam...
>
> let me take two minutes from your time to tell you about Islam...
> I will be happy to receive your questions and i promise that i will search
> in Al-Quran and Al-sunnah ( Prophet Mohammad speech ) to reply on your
> questions *
>
> Introduction to Islam
>
> The literal meaning of Islam is peace; surrender of one's will i.e. losing
> oneself for the sake of God and surrendering one's own pleasure for the
> pleasure of God. The message of Islam was revealed to the Holy Prophet
> Muhammad (peace and blessings on him) 1, 400 years ago. It was revealed
> through angel Gabriel (on whom be peace) and was thus preserved in the Holy
> Quran. The Holy Quran carries a Divine guarantee of safeguard from
> interpolation and it claims that it combines the best features of the
> earlier scriptures. The prime message of Islam is the Unity of God,
> that the Creator of the world is One and He alone is worthy of worship and
> that Muhammad (peace and blessings on him) is His Messenger and Servant. The
> follower of this belief is thus a Muslim - a Muslim's other beliefs are:
> God's angels, previously revealed Books of God, all the prophets, from Adam
> to Jesus (peace be on them both), the Day of Judgement and indeed the Decree
> of God. A Muslim has five main duties to perform, namely; bearing witness to
> the Unity of God and Muhammad (peace and blessings on him) as His Messenger,
> observing the prescribed prayer, payment of Zakat, keeping the fasts of
> Ramadhan and performing the pilgrimage to Mecca. Islam believes that
> each person is born pure. The Holy Quran tells us that God has given human
> beings a choice between good and evil and to seek God's pleasure through
> faith, prayer and charity. Islam believes that God created mankind in His
> image and by imbuing the attributes of God on a human level mankind can
> attain His nearness. Islam's main message is to worship God and to treat all
> God's creation with kindness and compassion. Rights of parents in old age,
> orphans and the needy are clearly stated. Women's rights were safeguarded
> 1,400 years ago when the rest of the world was in total darkness about
> emancipation. Islamic teachings encompass every imaginable situation and its
> rules and principles are truly universal and have stood the test of time.
>In Islam virtue does not connote forsaking the bounties of nature that
> are lawful. On the contrary one is encouraged to lead a healthy, active life
> with the qualities of kindness, chastity, honesty, mercy, courage patience
> and politeness. In short, Islam has a perfect and complete code for the
> guidance of individuals and communities alike. As the entire message of
> Islam is derived from the Holy Quran and indeed the Sunnah and Hadith (the
> traditions and practices of the Holy Prophet, peace and blessings on him) it
> is immutable in the face of change in time and place. It may appear rigid to
> the casual eye, in actual fact it is most certainly an adaptable way of life
> regardless of human changes. Islam teaches that the path to spiritual
> development is open to all. Any individual who searches the One Creator can
> seek nearness to God through sincere and earnest worship; it is central to
> establishing a relationship with the Almighty. This positive message for
> humanity fills hearts with hope and courage. At present there are 
> 1.5billion Muslims worldwide and they form the majority in more than 50
> countries of the world. Today Islam is the fastest growing faith in the
> world - its beautiful message is reaching millions in the far corner of the
> earth.
>
> *Warm Regards,
> Islam Massage Magazine*
>
> >
>

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



Re: Printable article page URLs?

2008-01-02 Thread Alex Koshelev

The second variant with GET query is the best. One resouce has one uri
but with query you specify it's display properties.

On 3 янв, 01:52, Mordy Ovits <[EMAIL PROTECTED]> wrote:
> I really like Django's policy of readable URLs and one authoritative
> page.  My question is how do I do printable versions of those nice
> and authoritative urls?
>
> Say I have this:http://www.site.com/articles/slug
>
> I can think of two general 
> ways:http://www.site.com/print_articles/slughttp://www.site.com/articles/slug?page=print
>
> Each has issues.  The first one needs a robots.txt fix to prevent the
> print versioned from being spidered, but at least it can be done.
> The second one is not amenable to a robots.txt fix.  The second one
> is also "ugly" in my subjective django-influenced opinion.
>
> So what do you folks suggest for printable versions of article pages?
> Please don't suggest CSS, I know about it and it's not really an
> option for me.
>
> Thanks,
> Mordy
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Templates with multiple repeating blocks

2008-01-02 Thread stryderjzw

Hi,

I have the same situation as a thread (http://groups.google.com/group/
django-users/browse_thread/thread/2dbb2b7f01951a2/efbeb1f74be6e454?
lnk=gst=multiple+template+block) started in 2005. The idea is that
in my template, I want to use the same template block for both the
 and  tags.

I didn't seem to find any solutions for this. Has this been considered
since 2005? If not, what's a good solution to solve this problem? I'm
just duplicating this right now in my template.

Thanks,

Justin

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



Re: How to check which view got called by a request

2008-01-02 Thread James Bennett

On Jan 2, 2008 4:09 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> It doesn't seem to be possible to work out the exact Python function
> that was called (the necessary information isn't always available, since
> it could, for example, be a middleware function that short-circuited
> things).

Setting aside the corner case of impossible-to-track-down edge cases,
the XViewMiddleware does a pretty good job of solving this.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Printable article page URLs?

2008-01-02 Thread Mordy Ovits

I really like Django's policy of readable URLs and one authoritative 
page.  My question is how do I do printable versions of those nice 
and authoritative urls?

Say I have this:
http://www.site.com/articles/slug

I can think of two general ways:
http://www.site.com/print_articles/slug
http://www.site.com/articles/slug?page=print

Each has issues.  The first one needs a robots.txt fix to prevent the 
print versioned from being spidered, but at least it can be done.   
The second one is not amenable to a robots.txt fix.  The second one 
is also "ugly" in my subjective django-influenced opinion.

So what do you folks suggest for printable versions of article pages?  
Please don't suggest CSS, I know about it and it's not really an 
option for me.

Thanks,
Mordy


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



Re: django.db.models.Q for OR lookup is having issues with NULL values

2008-01-02 Thread Malcolm Tredinnick


On Wed, 2008-01-02 at 14:25 -0800, Peter wrote:
> I am trying to filter by users who are not staff, but this user column
> accepts NULL values in my model.
> 
> As a result I need to check for user__isnull, since
> user__is_staff=False will not work for null values.
> 
> I tried:
>   Post.objects.filter(Q(user__isnull=True) | Q(user__is_staff=False))
> but this returned nothing, while a plain old:
>   Post.objects.filter(user__isnull=True)
> returns a query set with Post objects.
> 
> I tried rewriting this as a NAND:
>  
> Post.objects.exclude(user__isnull=False).exclude(user__is_staff=True)
> but this didn't work either.
> 
> Is this a bug?

This is basically #2080 (and a number of other variants).

Regards,
Malcolm

-- 
The early bird may get the worm, but the second mouse gets the cheese. 
http://www.pointy-stick.com/blog/


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



django.db.models.Q for OR lookup is having issues with NULL values

2008-01-02 Thread Peter

I am trying to filter by users who are not staff, but this user column
accepts NULL values in my model.

As a result I need to check for user__isnull, since
user__is_staff=False will not work for null values.

I tried:
  Post.objects.filter(Q(user__isnull=True) | Q(user__is_staff=False))
but this returned nothing, while a plain old:
  Post.objects.filter(user__isnull=True)
returns a query set with Post objects.

I tried rewriting this as a NAND:
 
Post.objects.exclude(user__isnull=False).exclude(user__is_staff=True)
but this didn't work either.

Is this a bug?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to check which view got called by a request

2008-01-02 Thread Malcolm Tredinnick


On Sat, 2007-12-29 at 20:27 -0800, shabda wrote:
> Using the testing framework how can we make sure that the correct view
> got called.
> 
> Documentation at http://www.djangoproject.com/documentation/testing/#testcase
> says that
> (django.test.client can be used to) "Test that the correct view is
> executed for a given URL.", but I can't figure out how.

It doesn't seem to be possible to work out the exact Python function
that was called (the necessary information isn't always available, since
it could, for example, be a middleware function that short-circuited
things).

Regards,
Malcolm

-- 
Borrow from a pessimist - they don't expect it back. 
http://www.pointy-stick.com/blog/


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



Re: Make Django admin edit return to custom page?

2008-01-02 Thread Malcolm Tredinnick


On Sat, 2007-12-29 at 00:55 -0800, Ulf Kronman wrote:
> Hi all,
> I'm using Django to build a repository of scientific publications at
> my university.
> 
> Now we need to edit publication records that have been supplied by our
> departments and imported into the database.
> 
> I would like to be able to use the excellent Django admin interface
> for this editing, but my problem is that I would like my editors to be
> able to start from a custom-made list of publications that need
> editing and then return back to this custom list, after having edited
> a record in the admin interface.
> 
> The default behavior of the admin edit is to return the user to a
> neutral listing of the type of records being edited. Is there a way to
> change this behavior and make it return to another page, preferably
> using some kind of dynamic referrer parameter?

The admin interface isn't really designed to be customised like that.
Rather, the principle is that if you can edit one record, you can edit
them all.

However, a bit of reading of the source -- in particular,
contrib.admin.views.main -- will reveal some approaches that could be
used if you really wanted to. For example, the change_stage view (which,
along with add_stage() is used to process a model submission) sends the
user back to "../" upon success. So you could write a custom URLConf
entry that overrides that URL (admin///) and presented
them with the page you want to show them.

That sort of thing requires a little bit of planning out, but I can say
from exprience that it generally works out fairly well. There's a little
bit of duplication, since you need to write a view that is almost, but
not quite, exactly like the standard admin view. However, you can use
the normal admin templates and everything.

It takes a little bit of tiem to get this to work, but it's not
impossible.

Regards,
Malcolm
\
-- 
Atheism is a non-prophet organization. 
http://www.pointy-stick.com/blog/


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



Re: TypeError: Cannot resolve keyword '' into field. Choices are: ...

2008-01-02 Thread Malcolm Tredinnick


On Sat, 2007-12-29 at 00:30 -0800, sector119 wrote:
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/people/person/
> Exception Type:   TypeError
> Exception Value:  Cannot resolve keyword '' into field. Choices are:
> organizationdatabase, meterreadings, transaction, id, pid, location,
> street, building, corpus, block, appartment, first_name, last_name,
> middle_name, hd, population, space, rooms, privilege, comment
> Exception Location:   /home/sector119/devel/django_src/django/db/models/
> query.py in lookup_inner, line 1044
> Python Executable:/usr/bin/python2.5
> Python Version:   2.5.1
> 
> I got this exception when I use Q objects. When I use queryset =
> queryset.filter(last_name=query) everything is ok, why?

There's a lot of code to wade through here, so it's a bit hard to work
out what might be going wrong. I would suggest trying to reduce things
to the smallest possible example that exhibits the problem. Work out
what the exact Q-object is that is causing the trouble -- what
parameters are passed to it. Then work out if yo ucan replicate the
problem by typing in that query at the Python prompt, etc.

Essentially, eliminate all the code that tries to construct the query
and just work with the query that is causing the problems. Then you've
reduced the problematic case to a single line of code. If you can't do
that, it means the problem is with the way you are constructing the
query, so you know where to look further.

Regards,
Malcolm

-- 
Why be difficult when, with a little bit of effort, you could be
impossible. 
http://www.pointy-stick.com/blog/


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



Re: django widget combo box

2008-01-02 Thread mike

I have used the formtags that is inluded in the nongselect tar
package. It seems with the development version of django the import
statements   {% load formtags %}  no longer work,   I need a way to
replace the

{% selectrow form.reporter "/myapp/reporter_lookup/?q=%{searchString}"
"first_name" %}

Line with raw html for a text input box that will call this ajax
function for me.   I have been googling for days with no luck.
I'm using the newforms library and  form_for_instance


On Dec 15 2007, 9:01 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Dec 15, 1:40 am, mike <[EMAIL PROTECTED]> wrote:
>
> >http://code.djangoproject.com/wiki/AJAXWidgetComboBox
>
> > Has anyone had any luck with this, I get to the template section and
> > cant get past the {% load formtags %} part.  I found a formtags.py
> > from "Koders search" by googling and placed in the django templatetags
> > folder, but keep getting this error
>
> > 'formtags' is not a valid tag library: Could not load template library
> > from django.templatetags.formtags, No module named formtags
>
> Hi, I'm the original author of that widget though I don't use it
> anymore myself so I'm not even sure it will work with recent versions
> of django. The formtags.py file is included with the
> nongselect-1.0.tar.gz file attached to that page. Who knows whether
> the one you are using is the same as the one I wrote.
>
> regards
>
> matthew
>
> --
> Matthew Flanaganhttp://wadofstuff.blogspot.com
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How do I connect to development server with my browser?

2008-01-02 Thread cjl

Keith:

If you want to take your first steps learning Django without
installing it, I work on a tutorial in my spare time called Instant
Django:

http://www.instantdjango.com

It includes a download that contains a portable Django environment
that runs under Windows, no installation required, and uses the Django
development server and sqlite. It will even from from a USB thumb
drive. There is also a simple tutorial, which takes you through the
steps in creating a very rudimentary Django project.

Of course, part of learning Django is learning how to install and
deploy it, but in my opinion installation shouldn't be the first thing
you need learn.

It needs to be updated, but it should work for your purposes. As soon
as I can find the time I will finish the second chapter of the
tutorial, but I am now working between 60 and 80 hours a week at my
"day job", which has nothing to do with computers or programming, and
my wife is pregnant and due in two weeks, so it may be a while before
I get to it.

Anyway, good luck learning Django!
-cjlesh
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Strangeness with Postgres and Order_by() ...

2008-01-02 Thread ZebZiggle

Hi all!

I'm seeing a really strange behavior.

I have a query

q = Company.objects.filter(asOf__isnull = False).filter(Q(exchange =
1) | Q(exchange = 2)).order_by("name")[1:50]

When I run it from the command prompt, it gives proper results.

But when I run it as the web application / view, the sort doesn't seem
to be working. That is, I get the records back in the order they were
added.

I did q._get_sql_clause() to see what the difference was ... and there
isn't any to speak of:

>From the view code:

([...fields...],
' FROM "igapp_company" WHERE
("igapp_company"."asOf" IS NOT NULL AND
("igapp_company"."exchange" = %s OR "igapp_company"."exchange" = %s))
ORDER BY "igapp_company"."name" ASC LIMIT 25 ', [1, 2])

>From the command prompt:

([...fields...],
' FROM "igapp_company" WHERE
("igapp_company"."asOf" IS NOT NULL AND
("igapp_company"."exchange" = %s OR "igapp_company"."exchange" = %s))
ORDER BY "igapp_company"."name" ASC LIMIT 49 OFFSET 1 ', [1, 2])

Has anyone else experienced such behavior?

I've reindexed the affected table with no difference.

Thoughts?

-Zeb

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



Re: Getting exception 'User' object has no attribute 'backend'

2008-01-02 Thread James Bennett

On Jan 2, 2008 1:57 PM, shabda <[EMAIL PROTECTED]> wrote:
> I have this code,
> from django.contrib.auth import login
> user = User.objects.get(username =
> login_form.cleaned_data['username'])
> login(request, user)
> Which is giving me exception 'User' object has no attribute 'backend'

>From the Django authentication docs:

http://www.djangoproject.com/documentation/authentication/#how-to-log-a-user-in

"Calling authenticate() first
When you're manually logging a user in, you must call authenticate()
before you call login(). authenticate() sets an attribute on the User
noting which authentication backend successfully authenticated that
user (see the backends documentation for details), and this
information is needed later during the login process."


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: Recommended tool for web load & stress testing

2008-01-02 Thread Ryan K

For all your testing needs http://www.softwareqatest.com/qatweb1.html

On Jan 2, 2:58 pm, mamcxyz <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I wonder what tool let me to do web load & stress testing with this
> options:
>
> - Run on Windows, test target are windows & solaris
> - Simulate diferent users, with separation of surfers vs content
> uploaders (ej: send photos, links, etc)
> - Tell me page size & maybe benefits on caching?
> - Correlate the memory & cpu load to the page fetching?
> - Maybe provide nice grpahs or at least csv files.
>
> Could by script based or a gui.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Recommended tool for web load & stress testing

2008-01-02 Thread mamcxyz

Hi,

I wonder what tool let me to do web load & stress testing with this
options:

- Run on Windows, test target are windows & solaris
- Simulate diferent users, with separation of surfers vs content
uploaders (ej: send photos, links, etc)
- Tell me page size & maybe benefits on caching?
- Correlate the memory & cpu load to the page fetching?
- Maybe provide nice grpahs or at least csv files.

Could by script based or a gui.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Getting exception 'User' object has no attribute 'backend'

2008-01-02 Thread shabda

I have this code,
from django.contrib.auth import login
user = User.objects.get(username =
login_form.cleaned_data['username'])
login(request, user)
Which is giving me exception 'User' object has no attribute 'backend'

Traceback:
File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
get_response
  82. response = callback(request, *callback_args,
**callback_kwargs)
File "E:\newforms\newf\views.py" in login
  31. login(request, user)
File "C:\Python24\lib\site-packages\django\contrib\auth\__init__.py"
in login
  57. request.session[BACKEND_SESSION_KEY] = user.backend

The login method from contrib.auth is
def login(request, user):
"""
Persist a user id and a backend in the request. This way a user
doesn't
have to reauthenticate on every request.
"""
if user is None:
user = request.user
# TODO: It would be nice to support different login methods, like
signed cookies.
user.last_login = datetime.datetime.now()
user.save()
request.session[SESSION_KEY] = user.id
request.session[BACKEND_SESSION_KEY] = user.backend
if hasattr(request, 'user'):
request.user = user
and the user model obviously doesnot have a backend attribute, what am
I missing?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django CSS

2008-01-02 Thread Ronaldo Z. Afonso

Hi Thomas,

Thanks. It helped me a lot.
Ronaldo.

On Wed, 2008-01-02 at 06:28 -0800, Thomas wrote:
> Ronaldo, have a look here: 
> http://www.djangoproject.com/documentation/static_files/
> 
> Thomas
> 
> 
> On Jan 2, 3:23 pm, "Ronaldo Z. Afonso" <[EMAIL PROTECTED]>
> wrote:
> > Hi all,
> >
> > I'm having some problems with Django and CSS. It seems that my templates
> > just don't load the CSS file. I'm using some think like this:
> >
> > 
> >
> > and the "file.css" is in the same directory as all my templates, but all
> > my pages are with no style.
> > So is there any special thing to do to use CSS with Django? Or can
> > anybody point me to a documentation about CSS in Django? I just found
> > one about CSS and the admin interface.
> >
> > Thanks in advance.
> > Ronaldo.
> > 


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



Re: How do I connect to development server with my browser?

2008-01-02 Thread Peter Rowell

> My son gave me some space to play in on an Apache server he rents.

Is this a dedicated server or a shared hosting account?

Dedicated? Carry on.

Shared? Watch out! Many shared hosting providers frown on (or outright
forbid) "long running processes." Without thinking about what I was
doing, I started working through the Django tutorial on a 1and1.com
account. The third time I tried to run the development server (It just
wouldn't seem to work) I suddenly found myself locked out of my
account (and all of my domains blocked for web and mail) for 24 hours.

If you need your own play space for cheap, checkout http://www.webfaction.com/.
$10/month with user-configurable Apache. Alternatively, get an old PC,
slap on Ubuntu Linux (or the distro of your choice), and run a local
server. This has the benefit of letting you pickup some LAMP (Linux,
Apache, MySQL, Python) skills while learning Django. Warning: There
can be several steepish learning curves involved here, although most
distros come with a default LAMP setup installed for you. If you are
planning on selling your skills, this might be the right route to take.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Add Add "georss" tag to feeds

2008-01-02 Thread David Larlet

Le 20 déc. 07 à 10:27, Daniel de la Cuesta a écrit :

> Hi all,
>
> I want to add the geo tag (with latitude and longitude) to each item  
> of my feeds:
>
> 45.256 -71.92
> I am using the feeds framework:
> class LatestEvents(Feed):title = "Latest Events"link  
> = "/events/"def items(self):return  
> Event.objects.order_by('-start_date')[:5]
> Is there any way to add the new node to each item returned by  
> "items()"
> Thank you.


Daniel,

Attached is my current solution which is not really elegant but works.  
That's why I cross post to the developers mailing-list, maybe we can  
find a better way to handle that? There is a lot of duplicate code in  
my solution (and maybe there is a better one?, let me know) but I  
could easily generate a patch against the trunk for that.

Btw, I had noticed a bug in the SyndicationFeed class of django  
feedgenerator, language is the only parameter where force_unicode is  
applied and it returns u"None". This "conversion" cause problem in the  
"if self.feed['language'] is not None:" test. If you replace  
force_unicode by to_unicode it works. I'd submitted a bug and a patch  
on Trac, see #6303.

While we are at feeds, I got a "cosmetic" question. It seems that each  
generated feed in Django is not highlighted by Firefox when you read  
the source. Is there a reason to that? I can't find a way to find the  
cause.

Thanks,
David


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

from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.feedgenerator import SyndicationFeed, Atom1Feed, rfc3339_date, get_tag_uri

class GeoSyndicationFeed(SyndicationFeed):
def add_item(self, title, link, description, author_email=None,
author_name=None, author_link=None, pubdate=None, comments=None,
unique_id=None, enclosure=None, categories=(), item_copyright=None, 
ttl=None, georss=()):
"""
Adds an item to the feed. All args are expected to be Python Unicode
objects except pubdate, which is a datetime.datetime object, and
enclosure, which is an instance of the Enclosure class.
"""
super(GeoSyndicationFeed, self).add_item(title=title, link=link, 
description=description, 
author_email=author_email, author_name=author_name, 
author_link=author_link, pubdate=pubdate, comments=comments,
unique_id=unique_id, enclosure=enclosure, categories=categories, 
item_copyright=item_copyright, ttl=ttl)
self.items[-1]['georss'] = georss and u"%s %s" % georss or None


class GeoAtom1Feed(Atom1Feed, GeoSyndicationFeed):

def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding)
handler.startDocument()
if self.feed['language'] != u'None':
handler.startElement(u"feed", {
u"xmlns": self.ns, 
u"xml:lang": self.feed['language'],
u"xmlns:georss": u"http://www.georss.org/georss;,
u"xmlns:gml": u"http://www.opengis.net/gml"})
else:
handler.startElement(u"feed", {
u"xmlns": self.ns,
u"xmlns:georss": u"http://www.georss.org/georss;,
u"xmlns:gml": u"http://www.opengis.net/gml"})
handler.addQuickElement(u"title", self.feed['title'])
handler.addQuickElement(u"link", "", {u"rel": u"alternate", u"href": self.feed['link']})
if self.feed['feed_url'] is not None:
handler.addQuickElement(u"link", "", {u"rel": u"self", u"href": self.feed['feed_url']})
handler.addQuickElement(u"id", self.feed['id'])
handler.addQuickElement(u"updated", rfc3339_date(self.latest_post_date()).decode('ascii'))
if self.feed['author_name'] is not None:
handler.startElement(u"author", {})
handler.addQuickElement(u"name", self.feed['author_name'])
if self.feed['author_email'] is not None:
handler.addQuickElement(u"email", self.feed['author_email'])
if self.feed['author_link'] is not None:
handler.addQuickElement(u"uri", self.feed['author_link'])
handler.endElement(u"author")
if self.feed['subtitle'] is not None:
handler.addQuickElement(u"subtitle", self.feed['subtitle'])
for cat in self.feed['categories']:
handler.addQuickElement(u"category", "", {u"term": cat})
if self.feed['feed_copyright'] is not None:
handler.addQuickElement(u"rights", self.feed['feed_copyright'])

Re: how to deal with inherited template context variables?

2008-01-02 Thread Sam Lai

There's no reason, apart from the fact that I feel like I'm repeating
myself in the views. I'm thinking template tags, because the template
inheritance tree has to be specified in the templates. Therefore it is
the only place to load necessary context variables without having to
repeat the inheritance tree (e.g. using views inheritance).

There have been many approaches offered up here, many that are
similar. I'm leaning towards a generic template tag for the above
reasons, but there are probably reasons against that that I'll bump
into later.

Just curious how others tackle this problem.

Thanks for all the responses!

Sam

On Jan 1, 5:48 am, Brian Costlow <[EMAIL PROTECTED]> wrote:
> Sam,
>
> Am I missing something, or is there a reason you don't just factor out
> the common bits into a function or set of functions in views.py, or a
> library it imports?
>
> For a couple of simple things we do on multiple sites (e.g. we do
> friendly names including Title and Suffix etc, from data in the
> related profile for a User) we have custom tags.
>
> For one site where we have some site specific stuff we added a context
> processor.
>
> But for stuff that is application specific, but is used in more than
> one view, we just factored common bits out into helper functions.
>
> def init_appwide_temp_vars(request):
>     """ Return a dictionary of template vars used in all of this app's
> views"""
>     app_response_dict = dict()
>     app_response_dict['latest_5_blog_posts'] = entries.objects.all()[:
> 5]
>     ... # code to add more vars to dict
>     return app_response_dict
>
> def blog_entry(request):
>     view_response_dict = init_appwide_temp_vars(request)
>     ... # code to add view specific vars to dict
>     return render_to_response("blog/entry.htm", view_response_dict)
>
> def archive(request):
>     view_response_dict = init_appwide_temp_vars(request)
>     ... # code to add view specific vars to dict
>     return render_to_response("blog/archive.htm", view_response_dict)
>
> It does hit the db for the same data every time through, but we are
> caching, and so far haven't seen any issues. I don't think it's any
> more db intensive then the extra context processing.
>
> In one app where things are a bit more complex, we use classes and
> inheritance to organize the views in parallel to the template
> inheritance. The classes' __init__ method sets up the common stuff,
> calling super as necessary. Then the call to the view function is just
> a wrapper to instantiate the correct object and call a run method,
> which adds the view specific variables and calls render_to_response.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Foreign key drop down not updating in newforms

2008-01-02 Thread Nathaniel Whiteinge

On Dec 30 2007, 6:46 pm, makebelieve <[EMAIL PROTECTED]> wrote:
> Part of a form of mine has a drop down to choose a region which is a
> foreign key to the object I'm updating.  Further, I have a link to add
> a new region if the user does not see what they want.  If a user adds
> a new region it is successfully made in the database, but it will not
> show up in the drop down until I restart my web server.  Is there a
> way around this?

The problem you're having is usually referred to as import-time vs.
execution-time, and is definitely worth reading up on as you're
starting to learn Python. What is happening is the for-loop is only
being run one time as Python is starting up (which affects long-
running Python processes such as the one started by Apache, for
example). A simplified explanation is that your class is being defined
in memory as Python starts-up and the region_choices value is
essentially hard-coded for the duration. You can get around this by
putting your for-loop in a method, since it will be re-run every time
the method is called.

Fortunately, Django has an even better solution for what you're trying
to do: use a ModelChoiceField instead -- it'll handle all that
ForeignKey business for you automatically. It not currently
documented, but you can find example usage here [1] (use your
browser's find).

.. [1] http://www.djangoproject.com/documentation/models/model_forms/

Cheers.
- whiteinge
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Shopping cart

2008-01-02 Thread kevinski

http://code.google.com/p/django-cart/

A much shorter learning curve than Satchmo, but a fraction of the
functionality.

On Jan 2, 9:37 am, [EMAIL PROTECTED] wrote:
> Hi all,
> Is there a good python shopping cart that works well with django?
> Thanks,
>
> Jorge Hugo Murillo
>
>       
> ___­_
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.  
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread Greg

Hedronist,
Thanks for the reply.  I tried your suggestion but it still doesn't
work.  Thanks for the link.  I'll look it over and hopefully be able
to solve the problem.

In regards to having all of my pages as close to the root as
possible.  I was reading that search engines put more importance to
pages that are closes to the root.  So that for example the following
pages:

www.mysite.com/sprint/cellular/M1000/
www.mysite.com/sprint_cellular_M1000/

>From what I understand google will think that the second second
example is more important than the first example because it's only one
level from the root.  I know that using Django there is no directory
structure.  But I guess that search engines haven't picked up on that
yet.  I'm guessing that when google finds a '/' it thinks the page is
one more level from the root which means it's less important.

Has anybody else heard of this?

On Jan 2, 9:50 am, hedronist <[EMAIL PROTECTED]> wrote:
> > Tried it...still no good
>
> When in doubt, supply specifics, as in 'exactly what is the specific
> URL you are trying to match?'
>
> The given pattern matches an appropriate URL correctly. E.g.
>
> >>> import re
> >>> x = 'foobar_abcde/'
> >>> m = re.match(r'^(?P[a-zA-Z]+)_(?P[a-zA-Z]+)/$', x)
> >>> print m.groupdict()
>
> {'line': 'abcde', 'manufacturer': 'foobar'}
>
> I will observe, however, that \w in your original pattern also matches
> 0-9, so if you happen to be testing with numbers in either the
> manufacturer or line portion of the URL, it ain't gonna work. It also
> won't work if you are not supplying the trailing slash.
>
> Going back to the original pattern, there is another way to write it.
> If you change your pattern from:
>   (r'^(?P[\w-]+)_(?P[\w-]+)/$', 'showline')
> to:
>   (r'^(?P[\w-]+?)_(?P[\w-]+?)/$', 'showline')
> it will work as desired.
>
> The '?' makes the '+' non-greedy, meaning it will grab as little as it
> can and still successfully match. Thus, it won't consume the '_'
> because that would cause failure.
>
> If you are relatively new to regular expressions, I strongly recommend
> perusing the Python re docs athttp://docs.python.org/lib/module-re.html.
> Read the section on syntax a few times (it can be subtle and deep),
> construct some test patterns to play with, and make sure they match
> (and don't match) as you would expect them to.
>
> Out of curiosity, what do you mean when you say "so that all of my
> pages are as close to the root as possible"? In a 'normal' web site,
> the slashes actually indicate the directory hierarchy, but in Django
> they mean ... whatever you want them to mean. Once you start having
> fun with URL mapping, the whole concept of 'the root' largely goes
> away. I now look at URLs as being procedure calls with optional
> arguments.
>
>   HTH,
>   Peter
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Raising Http Redirect

2008-01-02 Thread Marty Alchin

Given that I've thought a bit about this not too long ago[1], I'll
pipe in with my little bit of philosophy, along with some advice on
the topic at hand.

Exceptions are, by definition, exceptional. They defy the rule. That
could mean errors, but it could also mean any other situation that a
particular rule doesn't account for. Ultimately, you can only define
exceptions with regard to the rules they defy, and the rules followed
by a piece of code are dictated entirely by the developer of that
code. If you don't want your flow to accommodate a situation, you're
welcome to raise an exception and have other code handle that case.

However, in the case of Django, the framework itself can't possibly
accommodate everyone's idea of how rules should be written. Instead,
it has to take a middle-of-the-road approach, trying to cover the most
common situations, while allowing other situations to be handled
easily. Clearly having an exception for redirects won't be necessary
(or even good) for most Django users, so it's not something that will
make it into the framework itself. Especially since, as has already
been mentioned on this thread, it's quite possible to accomplish with
middleware.

If, however, you'd like to see the existing HTTP exceptions refactored
in such a way that you could subclass them to create a redirecting
exception without the middleware, that's an entirely separate issue,
and one that would probably be better received. It still might not
make it into trunk, but I would think that it would be a much better
suggestion than "I'm doing non-standard practice X, can it be added to
Django so I can save myself a dozen (or less!) lines of code?" I'd
recommend creating a ticket for generalizing HTTP exceptions so that
the exception class can dictate what response gets sent. But don't
expect me to implement it.

-Gul

[1] http://gulopine.gamemusic.org/2007/nov/21/except-the-unexpected/
(Sorry if the page loads slowly or not at all, the server's having
issues)

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



Re: Django is more?

2008-01-02 Thread Tim Chase

> I am just curious if there is anyone out there that has used django to
> create things other than web applications.
> I've seen it done where I work-- we use django for our print accounting
> scripts.

I've used it for some ETL work (slurping in CSV files and 
churning them into the DB), which granted, had both a web 
front-end and a CLI front-end.  The distinction is a bit odd, as 
on the web, things are either static or dynamic.  And if they're 
dynamic, that's somewhat the definition of a "web application". 
So the only escape clause seems to be doing non-web related work. 
  In a way, it's kinda silly to use a web framework to do 
non-web-work.  Possible, but there are likely other better ways 
to do it.

I've seen a couple posts float by where somebody was doing a GUI 
application (I don't remember whether it was tkinter or wxPython 
based) that used the underlying Django framework but I haven't 
heard anything more about that.  I'd be leary of doing such if it 
involved more than personal use, as you need to distribute the DB 
password to each client.  But for personal use, it might suffice.

-tim





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



Re: Raising Http Redirect

2008-01-02 Thread Forest Bond
Hi,

On Wed, Jan 02, 2008 at 09:35:33AM -0600, James Bennett wrote:
> On Jan 2, 2008 8:20 AM, Forest Bond <[EMAIL PROTECTED]> wrote:
> > I disagree.  Exceptions represent "exceptional situations," not all of 
> > which are
> > necessarily errors.  For instance, SystemExit is not really an error, is it?
> > What about StopIteration?
> 
> By that analogy as well, exceptions would be the wrong choice here:
> what's "exceptional" about returning a redirect? A 404 or 500 is
> exceptional -- it's something outside of otherwise-routine operation.
> But redirecting from one page to another *is* a part of routine
> operation.

StopIteration represents a routine action: the end of a loop.  What is
exceptional about it is the interruption in flow, much like a redirection can be
thought of as an interruption in content generation (in a view).  An exception
means "stop what you're doing and deal with this new condition."

This is probably a pointless argument, though.  Clearly, you prefer to use
exceptions exclusively for error conditions, and I don't mind (ab)using them for
other purposes as well.  I view exceptions as a more general message-passing
mechanism with some advantageous properties, not just a red flag to throw when
things go sour.  I wouldn't use them for everything, but they do lend themselves
to some "stop that and do this instead" situations.

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net


signature.asc
Description: Digital signature


Re: Shopping cart

2008-01-02 Thread hedronist

I haven't tried to work with it yet, but you might want to checkout
(pun intended) the Django-based cart 'Satchmo' at http://www.satchmoproject.com/
and their newsgroup at http://groups.google.com/group/satchmo-users.
They are currently at 0.6 and are working on their roadmap to 1.0.

  Peter
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Shopping cart

2008-01-02 Thread Alex Koshelev

http://www.satchmoproject.com/

On 2 янв, 18:37, [EMAIL PROTECTED] wrote:
> Hi all,
> Is there a good python shopping cart that works well with django?
> Thanks,
>
> Jorge Hugo Murillo
>
>   
> 
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.  
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Raising Http Redirect

2008-01-02 Thread James Bennett

On Jan 2, 2008 9:37 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> If someone tries to save a form, but someone else was faster,
> then I want to leave the slower person a message, and redirect him to
> the form again. His changes will be lost.

Why not return a validation error from the form telling the user
what's happening, instead of silently throwing away their work? ;)


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread hedronist

> Tried it...still no good

When in doubt, supply specifics, as in 'exactly what is the specific
URL you are trying to match?'

The given pattern matches an appropriate URL correctly. E.g.

>>> import re
>>> x = 'foobar_abcde/'
>>> m = re.match(r'^(?P[a-zA-Z]+)_(?P[a-zA-Z]+)/$', x)
>>> print m.groupdict()
{'line': 'abcde', 'manufacturer': 'foobar'}

I will observe, however, that \w in your original pattern also matches
0-9, so if you happen to be testing with numbers in either the
manufacturer or line portion of the URL, it ain't gonna work. It also
won't work if you are not supplying the trailing slash.

Going back to the original pattern, there is another way to write it.
If you change your pattern from:
  (r'^(?P[\w-]+)_(?P[\w-]+)/$', 'showline')
to:
  (r'^(?P[\w-]+?)_(?P[\w-]+?)/$', 'showline')
it will work as desired.

The '?' makes the '+' non-greedy, meaning it will grab as little as it
can and still successfully match. Thus, it won't consume the '_'
because that would cause failure.

If you are relatively new to regular expressions, I strongly recommend
perusing the Python re docs at http://docs.python.org/lib/module-re.html.
Read the section on syntax a few times (it can be subtle and deep),
construct some test patterns to play with, and make sure they match
(and don't match) as you would expect them to.

Out of curiosity, what do you mean when you say "so that all of my
pages are as close to the root as possible"? In a 'normal' web site,
the slashes actually indicate the directory hierarchy, but in Django
they mean ... whatever you want them to mean. Once you start having
fun with URL mapping, the whole concept of 'the root' largely goes
away. I now look at URLs as being procedure calls with optional
arguments.

  HTH,
  Peter
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Raising Http Redirect

2008-01-02 Thread James Bennett

On Jan 2, 2008 8:20 AM, Forest Bond <[EMAIL PROTECTED]> wrote:
> I disagree.  Exceptions represent "exceptional situations," not all of which 
> are
> necessarily errors.  For instance, SystemExit is not really an error, is it?
> What about StopIteration?

By that analogy as well, exceptions would be the wrong choice here:
what's "exceptional" about returning a redirect? A 404 or 500 is
exceptional -- it's something outside of otherwise-routine operation.
But redirecting from one page to another *is* a part of routine
operation.

So, again, I'm against this.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: Raising Http Redirect

2008-01-02 Thread Thomas Guettler

Am Mittwoch, 2. Januar 2008 11:09 schrieb James Bennett:
> On Jan 2, 2008 3:49 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> > The HTTP return codes 404 and 500 can be raised with an exception.
> >
> > That's very handy. Unfortunately a Http Redirect can't be raised.
> > Do other django users thing this would be usefull, too?
>
> No. Exceptions represent "errors" in a program, and the 4xx and 5xx
> status codes represent "errors" in HTTP, so that maps well. But 3xx
> status codes in HTTP are not errors, so implementing them as
> exceptions would feel awfully strange.

Hi James,

in my case this redirect exception is a kind of error. But it is not
an error at http level.

My usecase:

The model MyModel has an attribute mtime. Everytime someone
edits it, the mtime gets updated.

The form to edit the Model has a hidden input with the mtime.

If someone tries to save a form, but someone else was faster,
then I want to leave the slower person a message, and redirect him to
the form again. His changes will be lost.

without exception:

response=obj.check_mtime(request)
if response:
return response

with exception:

obj.check_mtime(request)


Since the code will be written several times, I prefere the one line solution.


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



Shopping cart

2008-01-02 Thread jorgehugoma
Hi all,
Is there a good python shopping cart that works well with django?
Thanks,
 
Jorge Hugo Murillo





  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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



Re: update to the latest Django by svn, but serveral error comes...

2008-01-02 Thread James Bennett

As always, your questions are answered by the well-maintained list of
backwards-incompatible changes:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

Specifically, you want to read this:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Templatetagloadingrespectsdottednotation

And this:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Auto-escapingintemplates

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



update to the latest Django by svn, but serveral error comes...

2008-01-02 Thread [EMAIL PROTECTED]

1. the error is :
 TemplateSyntaxError at /groups/
'tagging.templatetags.tagging_tags' is not a valid tag library: Could
not load template library from
django.templatetags.tagging.templatetags.tagging_tags, No module named
tagging.templatetags.tagging_tags

the tagging is under c:\python25\lib\  as before, when i use it in
template like this: {% load tagging.templatetags.tagging_tags %}

it is ok in before updating, i think many django changes the way of
import templatetags, but i donot know how to change my code, can
someone help me, thanks!

2.
http://re.xianguo.com/images/logo.gif; alt="" /> 以下
是一篇IT评论,不喜欢的话,到这里就可以打住了。 日前,Rss订阅网站鲜果

this is the output of one page, it shows html tags directly other than
a images and paragraph after django updated to latest svn, sorry for
chinese content, can someone help me,thanks!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django CSS

2008-01-02 Thread Thomas

Ronaldo, have a look here: 
http://www.djangoproject.com/documentation/static_files/

Thomas


On Jan 2, 3:23 pm, "Ronaldo Z. Afonso" <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> I'm having some problems with Django and CSS. It seems that my templates
> just don't load the CSS file. I'm using some think like this:
>
> 
>
> and the "file.css" is in the same directory as all my templates, but all
> my pages are with no style.
> So is there any special thing to do to use CSS with Django? Or can
> anybody point me to a documentation about CSS in Django? I just found
> one about CSS and the admin interface.
>
> Thanks in advance.
> Ronaldo.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is more?

2008-01-02 Thread Brian Costlow

We have a Django web application that also uses parts of Django to
feed data to the database automatically.

There's an application built in Twisted that receives messages from
various other  servers and 'does something' based on the message.

One of the 'does somethings' is using the Django ORM from a Twisted
plug-in to write log data from the app servers to a database.

By the way, we're hiring someone to work on this and some other Python
projects. Details can be found on our corp website at www.vertisinc.com.
The url is not pretty.

http://hostedjobs.openhire.com/epostings/jobs/submit.cfm?fuseaction=dspjob=23=231854_id=15759=1=ONLINE=989651=levelid2=22967=Information%20Technology%20%3B%3B%3BSoftware%20Engineering%20=3=10908511=87685460

If that didn't work then click Careers, IT, SW engineering, and then
Software Engineer at either Irvine, TX or Earth City, MO. Or just
email me if you are interested.

Full disclosure. There's some PHP work involved as well, extending
this application:

http://www.xinet.com/tech/tech_techspecs.html




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



Django CSS

2008-01-02 Thread Ronaldo Z. Afonso

Hi all,

I'm having some problems with Django and CSS. It seems that my templates
just don't load the CSS file. I'm using some think like this:



and the "file.css" is in the same directory as all my templates, but all
my pages are with no style.
So is there any special thing to do to use CSS with Django? Or can
anybody point me to a documentation about CSS in Django? I just found
one about CSS and the admin interface.

Thanks in advance.
Ronaldo.



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



Re: Raising Http Redirect

2008-01-02 Thread Forest Bond
On Wed, Jan 02, 2008 at 04:09:43AM -0600, James Bennett wrote:
> 
> On Jan 2, 2008 3:49 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> > The HTTP return codes 404 and 500 can be raised with an exception.
> >
> > That's very handy. Unfortunately a Http Redirect can't be raised.
> > Do other django users thing this would be usefull, too?
> 
> No. Exceptions represent "errors" in a program, and the 4xx and 5xx
> status codes represent "errors" in HTTP, so that maps well. But 3xx
> status codes in HTTP are not errors, so implementing them as
> exceptions would feel awfully strange.

I disagree.  Exceptions represent "exceptional situations," not all of which are
necessarily errors.  For instance, SystemExit is not really an error, is it?
What about StopIteration?

The "error condition" semantics of exceptions are injected.

More practically, in Python, exceptions provide a simple way to trigger a major
state change in the application from a lower level in the call stack.  This is
frequently not an error.

A redirection exception seems natural to me; I've implemented something like
this myself in the past.

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net


signature.asc
Description: Digital signature


Re: Django is more?

2008-01-02 Thread Ramdas S
Oh! Great!

Shall follow this work

Ramdas

On Jan 2, 2008 7:20 PM, Daniel Mahoney <[EMAIL PROTECTED]> wrote:

>
> Yes, I am. I've created a SourceForge project for it (ISPython), am just
> waiting for the SF admins to approve it before I move the first files
> over (READMEs, an first draft of the Admin tool, etc).
>
> Ramdas S wrote:
> > Hi Dan,
> >
> > Are u by any chance planning to release it?
> >
> > Ramdas
> >
> > On Jan 2, 2008 6:34 PM, Daniel Mahoney <[EMAIL PROTECTED]
> > > wrote:
> >
> >
> > Jeff Anderson wrote:
> > > Hello,
> > >
> > > I am just curious if there is anyone out there that has used
> > django to
> > > create things other than web applications.
> > > I've seen it done where I work-- we use django for our print
> > accounting
> > > scripts.
> > >
> > > Does anyone else use django for a 
> > framework?
> > >
> > > Jeff Anderson
> > >
> > >
> > Well, strictly speaking it's still a web app, but I'm developing
> > an ISP
> > management tool (an alternative to Plesk, cPanel, ISPConfig, etc)
> > using
> > Django.
> >
> > Dan
> >
> >
> >
> >
> >
> > >
>
>
> >
>

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



Re: Django is more?

2008-01-02 Thread Daniel Mahoney

Yes, I am. I've created a SourceForge project for it (ISPython), am just 
waiting for the SF admins to approve it before I move the first files 
over (READMEs, an first draft of the Admin tool, etc).

Ramdas S wrote:
> Hi Dan,
>
> Are u by any chance planning to release it?
>
> Ramdas
>
> On Jan 2, 2008 6:34 PM, Daniel Mahoney <[EMAIL PROTECTED] 
> > wrote:
>
>
> Jeff Anderson wrote:
> > Hello,
> >
> > I am just curious if there is anyone out there that has used
> django to
> > create things other than web applications.
> > I've seen it done where I work-- we use django for our print
> accounting
> > scripts.
> >
> > Does anyone else use django for a 
> framework?
> >
> > Jeff Anderson
> >
> >
> Well, strictly speaking it's still a web app, but I'm developing
> an ISP
> management tool (an alternative to Plesk, cPanel, ISPConfig, etc)
> using
> Django.
>
> Dan
>
>
>
>
>
> >


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



Re: Help with form-builder application

2008-01-02 Thread WoonZai

Hi Jeff and Doug

Thank you for your prompt and helpful responses! I have to delay my
reply because I'm still figuring out certain core concepts of Python
that I need to read on before I can reply. :)

Jeff:

> Storing their results would be a bit ugly, unless you wanted to create new 
> tables for each time a user creates a new form.

Yes I plan to create a new table each time a user creates  a new form,
but I was stuck because I have no idea how to proceed with custom
columns for the table.

> Pickling is another python feature that I haven't looked into yet either.

I've looked into python pickling since both you and Doug used it, and
I think it's definitely helpful!

> http://code.djangoproject.com/wiki/CookBookNewFormsDynamicFields

Thank you, that looks good! It looks very similar to what I want to
do. And I realized I have yet to go through the wiki resources yet
(only checked the documentation, the API, the online book and Python
docs previously). I will try out the other resources on the wiki.

Doug:
> Your form definitions have nothing to do with the database.  They are 
> completely separate things.

I understood that somewhat, but I'm still not too clear of the
relationships and differences between forms, models and databases in
Django. I read the newforms library (http://www.djangoproject.com/
documentation/newforms/) and the django overview documentation (http://
www.djangoproject.com/documentation/overview/). To me, it appears that
the difference between them is their superclass. The model class
inherits from models.Model, and the forms class inherit from
forms.Form.

Let me make a wild guess based on my understanding so far. Classes
inherited from the Model can store the data in the table of the
database, while classes inherited from the Form can only receive/send
data via dictionary mappings, and store them only when they are
pickled (Thank you Jeff and Doug for introducing this concept to me).

> Make a basic model with a 'pickled' textfield.  The model fields represent 
> all the static/searchable fields.

What is the difference between static and searchable fields? Any links
that would be good reading for me to understand the concepts?

>   ... do something here to look at self.fieldmeta/instance/

I don't know what this means yet to ask any insightful questions, but
I figure it should be quite troublesome for one to explain. I will
read up more, and will ask about it again once I have a deeper level
of understanding of Django.

>   return type('GeneratedForm',(GeneratedBaseForm,),{''fieldmeta': 
> fieldmeta,base_fields': base_fields })

I get the hang of some of this, but I can't explain it clearly for
now. From my understanding, this passes a dictionary of data values
for the field meta and base fields to the forms to create it. I still
have to further read on what the "type" method does in here (Have not
gotten around to reading the docs for the type method yet).

> fieldmeta = FieldDef.objects.filter(name__in=['fieldname1','fieldname2'])
> Form = make_form(fieldmeta)
> form=Form()

> If you write the save method on the baseform carefully,

Correct me if I'm wrong - This saved data will be stored as a pickle,
and not saved in the database? Does that mean I will have to create a
new dump file for each new form created?

Thank you for your time Doug. Your email has opened me up to more
concepts to learn in Python and Django for me to proceed. :)

Cheers!
Vincent
Happy new year!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help with form-builder application

2008-01-02 Thread WoonZai

Hi Jeff and Doug

Thank you for your prompt and helpful responses! I have to delay my
reply because I'm still figuring out certain core concepts of Python
that I need to read on before I can reply. :)

Jeff:

> Storing their results would be a bit ugly, unless you wanted to create new 
> tables for each time a user creates a new form.

Yes I plan to create a new table each time a user creates  a new form,
but I was stuck because I have no idea how to proceed with custom
columns for the table.

> Pickling is another python feature that I haven't looked into yet either.

I've looked into python pickling since both you and Doug used it, and
I think it's definitely helpful!

> http://code.djangoproject.com/wiki/CookBookNewFormsDynamicFields

Thank you, that looks good! It looks very similar to what I want to
do. And I realized I have yet to go through the wiki resources yet
(only checked the documentation, the API, the online book and Python
docs previously). I will try out the other resources on the wiki.

Doug:
> Your form definitions have nothing to do with the database.  They are 
> completely separate things.

I understood that somewhat, but I'm still not too clear of the
relationships and differences between forms, models and databases in
Django. I read the newforms library (http://www.djangoproject.com/
documentation/newforms/) and the django overview documentation (http://
www.djangoproject.com/documentation/overview/). To me, it appears that
the difference between them is their superclass. The model class
inherits from models.Model, and the forms class inherit from
forms.Form.

Let me make a wild guess based on my understanding so far. Classes
inherited from the Model can store the data in the table of the
database, while classes inherited from the Form can only receive/send
data via dictionary mappings, and store them only when they are
pickled (Thank you Jeff and Doug for introducing this concept to me).

> Make a basic model with a 'pickled' textfield.  The model fields represent 
> all the static/searchable fields.

What is the difference between static and searchable fields? Any links
that would be good reading for me to understand the concepts?

>   ... do something here to look at self.fieldmeta/instance/

I don't know what this means yet to ask any insightful questions, but
I figure it should be quite troublesome for one to explain. I will
read up more, and will ask about it again once I have a deeper level
of understanding of Django.

>   return type('GeneratedForm',(GeneratedBaseForm,),{''fieldmeta': 
> fieldmeta,base_fields': base_fields })

I get the hang of some of this, but I can't explain it clearly for
now. From my understanding, this passes a dictionary of data values
for the field meta and base fields to the forms to create it. I still
have to further read on what the "type" method does in here (Have not
gotten around to reading the docs for the type method yet).

> fieldmeta = FieldDef.objects.filter(name__in=['fieldname1','fieldname2'])
> Form = make_form(fieldmeta)
> form=Form()

> If you write the save method on the baseform carefully,

Correct me if I'm wrong - This saved data will be stored as a pickle,
and not saved in the database? Does that mean I will have to create a
new dump file for each new form created?

Thank you for your time Doug. Your email has opened me up to more
concepts to learn in Python and Django for me to proceed. :)

Cheers!
Vincent
Happy new year!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is more?

2008-01-02 Thread Ramdas S
Hi Dan,

Are u by any chance planning to release it?

Ramdas

On Jan 2, 2008 6:34 PM, Daniel Mahoney <[EMAIL PROTECTED]> wrote:

>
> Jeff Anderson wrote:
> > Hello,
> >
> > I am just curious if there is anyone out there that has used django to
> > create things other than web applications.
> > I've seen it done where I work-- we use django for our print accounting
> > scripts.
> >
> > Does anyone else use django for a  framework?
> >
> > Jeff Anderson
> >
> >
> Well, strictly speaking it's still a web app, but I'm developing an ISP
> management tool (an alternative to Plesk, cPanel, ISPConfig, etc) using
> Django.
>
> Dan
>
> >
>

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



Re: Can I use a underscore in my url to separate variables?

2008-01-02 Thread Todd O'Bryan

Try downloading Kodos and sticking in your regex and the string you
want to match it and see what it says.

Todd

On Jan 2, 2008 12:59 AM, Greg <[EMAIL PROTECTED]> wrote:
>
> ocgstyles,
> Tried it...still no good
>
> (r'^(?P[a-zA-Z]+)_(?P[a-zA-Z]+)/$', 'showline'),
>
>
> On Jan 1, 11:23 pm, ocgstyles <[EMAIL PROTECTED]> wrote:
> > I'm confused now too...  :-/
> >
> > Try taking out the hyphen and see what happens...
> >
> > On Jan 1, 11:45 pm, Greg <[EMAIL PROTECTED]> wrote:
> >
> > > Todd,
> > > My app works fine.  When I have the following line in my url file then
> > > everything works fine
> >
> > > (r'^(?P[\w-]+)/(?P[\w-]+)/$', 'showline'),
> >
> > > /
> >
> > > It just doesn't work with I take out the '/' and replace it with the
> > > '_'
> >
> > > On Jan 1, 10:25 pm, "Todd O'Bryan" <[EMAIL PROTECTED]> wrote:
> >
> > > > Have you added the app to your INSTALLED_APPS ?
> >
> > > > Maybe you should paste in your site's urls.py as well as the app's.
> >
> > > > On Jan 1, 2008 11:09 PM, Greg <[EMAIL PROTECTED]> wrote:
> >
> > > > > ocgstyles,
> > > > > I've tried the following combinations however I still get the Page Not
> > > > > Found error:
> >
> > > > > (r'^(?P[a-zA-Z-]+)_(?P[a-zA-Z-]+)/$', 'showline'),
> > > > > (r'^(?P[-a-zA-Z]+)_(?P[-a-zA-Z]+)/$', 'showline'),
> > > > > (r'^(?P[a-zA-Z\-]+)_(?P[a-zA-Z\-]+)/$',
> > > > > 'showline'),
> > > > > (r'^(?P[a-zA-Z_]+)_(?P[a-zA-Z_]+)/$', 'showline'),
> >
> > > > > On Jan 1, 9:52 pm, ocgstyles <[EMAIL PROTECTED]> wrote:
> > > > > > I thought you wanted to capture either words or hyphens, so I just
> > > > > > replaced \w, which also consumes underscores, with [a-zA-Z], which
> > > > > > doesn't consume the underscores.  So the new regex
> >
> > > > > > [a-zA-Z-]+
> >
> > > > > > will consume one or more letters or hyphens.  The one I replaced it
> > > > > > with should work for sprint-phone_cellphone.
> >
> > > > > > On Jan 1, 10:36 pm, Greg <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > ocgstyles,
> > > > > > > I'm not sure what's going on.  What does the last '-' mean in the
> > > > > > > following code [a-zA-Z-]?  Occasionally I'm going to have the a 
> > > > > > > url
> > > > > > > that is going to have a '-' in the variable.  For 
> > > > > > > examplehttp://mysite.com/sprint-phone_cellphone.  So I'm not sure 
> > > > > > > if [a-zA-
> > > > > > > Z-] is going to work.
> >
> > > > > > > On Jan 1, 8:51 pm, ocgstyles <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > worked for me using the following:
> >
> > > > > > > > [urls.py] (i removed the single quotes around the view)
> > > > > > > > from myapp.views import showline
> > > > > > > > (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', showline),
> >
> > > > > > > > [views.py]
> > > > > > > > def showline(request, manufacturer, line):
> > > > > > > >return HttpResponse('manu = ' + manufacturer + 'line = 
> > > > > > > > ' +
> > > > > > > > line)
> >
> > > > > > > > Maybe the error is being generated from somewhere else?
> >
> > > > > > > > On Jan 1, 9:42 pm, Greg <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > ocgstyles,
> > > > > > > > > I tried the following however I'm still getting a page not 
> > > > > > > > > found
> > > > > > > > > error:
> >
> > > > > > > > > (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', 
> > > > > > > > > 'showline'),
> >
> > > > > > > > > On Jan 1, 8:23 pm, ocgstyles <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > Hi Greg,
> >
> > > > > > > > > > The problem is that "\w" is consuming the underscore.  
> > > > > > > > > > Instead of
> > > > > > > > > > using [\w-], use [a-zA-Z-].  The pattern would then look 
> > > > > > > > > > like:
> >
> > > > > > > > > > (r'^(?P[a-zA-Z-]+)_(?P[\w-]+)/$', 
> > > > > > > > > > 'showline')
> >
> > > > > > > > > > Hope that helps.
> >
> > > > > > > > > > Keith
> >
> > > > > > > > > > On Jan 1, 9:05 pm, Greg <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > > Hello,
> > > > > > > > > > > I orginially had my url like this:
> >
> > > > > > > > > > > (r'^(?P[\w-]+)/(?P[\w-]+)/$', 
> > > > > > > > > > > 'showline')
> >
> > > > > > > > > > > Which would work fine when going to the url 
> > > > > > > > > > > 'www.mysite.com/sprint/
> > > > > > > > > > > cellphone/'
> >
> > > > > > > > > > > //
> >
> > > > > > > > > > > However, I want to change my url structure so that all of 
> > > > > > > > > > > my pages are
> > > > > > > > > > > as close to the root as possible.  So I replaced my '/' 
> > > > > > > > > > > in the url
> > > > > > > > > > > with a '_'.  Like so:
> >
> > > > > > > > > > > (r'^(?P[\w-]+)_(?P[\w-]+)/$', 
> > > > > > > > > > > 'showline')
> >
> > > > > > > > > > > However, I now get a page not found whenever I view the 
> > > > > > > > > > > following url
> > > > > > > > > > > 'www.mysite.com/sprint_cellphone/'
> >
> > > > > > > > > > > 
> >
> > > > > > > > > > > Can I not replace the / with a _ in my url?
> >
> > > > > > > > > > > Thanks
> >
>

--~--~-~--~~~---~--~~
You received this message 

Re: Django is more?

2008-01-02 Thread Daniel Mahoney

Jeff Anderson wrote:
> Hello,
>
> I am just curious if there is anyone out there that has used django to
> create things other than web applications.
> I've seen it done where I work-- we use django for our print accounting
> scripts.
>
> Does anyone else use django for a  framework?
>
> Jeff Anderson
>
>   
Well, strictly speaking it's still a web app, but I'm developing an ISP 
management tool (an alternative to Plesk, cPanel, ISPConfig, etc) using 
Django.

Dan

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



Re: Psycopg2-2.0.6 build error

2008-01-02 Thread Karen Tracey
On Jan 2, 2008 12:07 AM, LRP <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> I'm trying to install django following directions in The Django Book.
> I would like to run with Postgres on my Debian etch system.
>
> When I try to build psycopg2.0.6 I get the error messages shown below.
> Would much appreciate any help to enable me to bring up a healthy
> system.
>
>
Why not just install a pre-built binary?  The note in the psycopg2 wiki
about psycopg 1 only being available in the Debian repositories seems to be
out of date, see:

http://packages.debian.org/etch/python-psycopg2


> ~/django/psycopg2-2.0.6$ python setup.py build
> running build
> running build_py
> creating build
> creating build/lib.linux-i686-2.4
> creating build/lib.linux-i686-2.4/psycopg2
> copying lib/psycopg1.py -> build/lib.linux-i686-2.4/psycopg2
> copying lib/errorcodes.py -> build/lib.linux-i686-2.4/psycopg2
> copying lib/pool.py -> build/lib.linux-i686-2.4/psycopg2
> copying lib/extensions.py -> build/lib.linux-i686-2.4/psycopg2
> copying lib/__init__.py -> build/lib.linux-i686-2.4/psycopg2
> copying lib/extras.py -> build/lib.linux-i686-2.4/psycopg2
> copying lib/tz.py -> build/lib.linux-i686-2.4/psycopg2
> running build_ext
> Warning: /bin/sh: pg_config: command not found
> building 'psycopg2._psycopg' extension
> creating build/temp.linux-i686-2.4
> creating build/temp.linux-i686-2.4/psycopg
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-
> prototypes -fPI C -DPY_MAJOR_VERSION=2 -DPY_MINOR_VERSION=4 -
> DHAVE_PYBOOL=1 -DHAVE_DECIMAL=1 -DH AVE_PYDATETIME=1 -
> DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.0.6 (dec dt  ext
> pq3)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_DISPLAY_SIZE=1 -
> DPSYCOPG_NEW_BOOLEAN =1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/usr/
> include/python2.4 -I. -c psyco pg/psycopgmodule.c -o build/temp.linux-
> i686-2.4/psycopg/psycopgmodule.o
> In file included from psycopg/psycopgmodule.c:29:
> ./psycopg/connection.h:27:22: error: libpq-fe.h: No such file or
> directory
> [more snipped]


If you do really want to build it yourself, this is the likely cause of the
following errors.  I don't know if libpq-fe.h comes with psycopg2 or
something else, but gcc can't find it.  You'd probably get more help fixing
this on a psycopg2 list than here.

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



Re: How to create an "iffirst" tag?

2008-01-02 Thread Ned Batchelder
I may be the only one still interested in this, but the patch got 
incorporated yesterday (http://code.djangoproject.com/changeset/6981), 
so Malcolm, your original idea will now work.

--Ned.

Ned Batchelder wrote:
> I tried out this change, and it works well.  I've created a ticket 
> (http://code.djangoproject.com/ticket/6295) with a patch.
>
> --Ned.
> http://nedbatchelder.com
>
> Ned Batchelder wrote:
>> Malcolm, thanks for continuing this (I was away for a few days).  I 
>> was thinking about the forloop internals as well, and it seems to me 
>> that there's no reason the forloop dictionary needs to be completely 
>> new each time around.  Why not change forloop to create a new 
>> dictionary before the first iteration, then update the dictionary on 
>> each iteration rather than replace it?
>>
>> BTW: this problem also plagues ifchanged: the docs say "check if a 
>> value has changed from the last iteration of a loop", which I guess 
>> is accurate, but I was surprised to find that it really only works if 
>> the ifchanged tag is evaluated on every iteration of the loop.
>>
>> --Ned.
>>
>> Malcolm Tredinnick wrote:
>>> Hey Ned,
>>>
>>> On Sat, 2007-12-29 at 08:27 +1100, Malcolm Tredinnick wrote:
>>> [...]
>>>   
 def render(self, context):
if context[self.varname] == id(context['forloop']):
   return self.nodelist_false.render(context)
context[self.varname] = id(context['forloop'])
return self.nodelist_true.render(context)
 
>>>
>>> This guess is rubbish. The problem is that the context['forloop']
>>> dictionary is a new instance for every iteration of the for-loop, so
>>> there's nothing constant about that outer structure we can use.
>>>
>>> After a bit of sleep, some food and some time spent thinking about this
>>> whilst doing other stuff today, there's a better solution (a.k.a one
>>> that works) attached to this mail. I've even tested this one.
>>>
>>> During any for-loop, the only thing that remains constant is the
>>> "parentloop" dictionary. That dictionary is created anew every time the
>>> *parent* loop steps forwards, but it is referred to by reference for
>>> each iteration of the inner loop. So we can stick a marker into the
>>> parent loop's data structure (even when there's no parent loop, that
>>> data structure is an empty dictionary).
>>>
>>> So, this implementation does depend a bit on the internals of the
>>> ForNode, but that isn't a complete crime. Plus it's been hard to come up
>>> with an alternative. Every time I thought of some tricky data structure
>>> that seemed to do the trick, I was able to break it. A template fragment
>>> such as
>>>
>>> {% for x in data %}
>>>{% if x %}
>>>   {% iffirst %} yes {% else %} no {% endfirst %}
>>>{% else %} fail {% endif %}
>>> {% endfor %}
>>> 
>>> given data = (0, 1, 1, 0) twice in succession (without recompiling), or
>>> giving data = (0, 1, 1, 0) and data = (0, 0, 1, 0) on successive runs
>>> (again, without recompiling) was enough to break most of my attempts.
>>>
>>> It's also not too hard to extend this to be check whether this is the
>>> first time around the parent loop using a similar method, although
>>> nested "iffirst" tags seems hard.
>>>
>>> Best wishes,
>>> Malcolm
>>>
>>>   
>>
>> -- 
>> Ned Batchelder, http://nedbatchelder.com
>>   
>>
>>
>
> -- 
> Ned Batchelder, http://nedbatchelder.com
>   
>
> >

-- 
Ned Batchelder, http://nedbatchelder.com


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



Re: Raising Http Redirect

2008-01-02 Thread James Bennett

On Jan 2, 2008 3:49 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> The HTTP return codes 404 and 500 can be raised with an exception.
>
> That's very handy. Unfortunately a Http Redirect can't be raised.
> Do other django users thing this would be usefull, too?

No. Exceptions represent "errors" in a program, and the 4xx and 5xx
status codes represent "errors" in HTTP, so that maps well. But 3xx
status codes in HTTP are not errors, so implementing them as
exceptions would feel awfully strange.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: Django is more?

2008-01-02 Thread Ben Ford
I've used the ORM as a kinda command line client for a database. It's pretty
quick and easy to do :-)

On 02/01/2008, Jeff Anderson <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am just curious if there is anyone out there that has used django to
> create things other than web applications.
> I've seen it done where I work-- we use django for our print accounting
> scripts.
>
> Does anyone else use django for a  framework?
>
> Jeff Anderson
>
>
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+6281317958862

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



Raising Http Redirect

2008-01-02 Thread Thomas Guettler

Hi,

The HTTP return codes 404 and 500 can be raised with an exception.

That's very handy. Unfortunately a Http Redirect can't be raised.
Do other django users thing this would be usefull, too?

I implemented it myself. But I think something like this should be in django.

#responseutils.py
class HttpRedirectException(Exception):
pass

# middleware.py
def process_exception(self, request, exception):
if isinstance(exception, responseutils.HttpRedirectException):
return django.http.HttpResponseRedirect(exception.args[0])

# usage
raise responseutils.HttpRedirectException(obj.get_absolute_url())

 Thomas

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