Re: URLs Syntax Error

2008-09-03 Thread mccomas . chris

i believe you need a comma after archive_info and before
{'template_name': 'blog/archive.html'}

On Sep 3, 7:40 am, djandrow <[EMAIL PROTECTED]> wrote:
> Can no one help me with this, its just these two lines:
>
>  (r'^archive/$', date_based.archive_index,archive_info
> {'template_name': 'blog/archive.html'}),
>  (r'^archive/(?Pd{4})/?$',date_based.archive_year, archive_info
> {'template_name': 'blog/archive.html'}),
>
> Please?
>
> Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: URLs Syntax Error

2008-09-03 Thread mccomas . chris

right.

could do dict(archive_dict, {'template_name': 'blog/archive.html'} )

On Sep 3, 8:40 am, Daniel Hepper <[EMAIL PROTECTED]> wrote:
> Adding a comma will probably not help, because you then have 5 values in
> the tuple, but the expected format is:
>
> (regular expression, Python callback function [, optional dictionary [,
> optional name]])
>
> Either you put the argument 'template_name' into the archive_info dict
> or you make two separate dicts.
>
> Daniel
>
> Am Mittwoch, den 03.09.2008, 05:26 -0700 schrieb
> [EMAIL PROTECTED]:
>
> > i believe you need a comma after archive_info and before
> > {'template_name': 'blog/archive.html'}
>
> > On Sep 3, 7:40 am, djandrow <[EMAIL PROTECTED]> wrote:
> > > Can no one help me with this, its just these two lines:
>
> > >  (r'^archive/$', date_based.archive_index,archive_info
> > > {'template_name': 'blog/archive.html'}),
> > >  (r'^archive/(?Pd{4})/?$',date_based.archive_year, archive_info
> > > {'template_name': 'blog/archive.html'}),
>
> > > Please?
>
> > > Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: URLs Syntax Error

2008-09-03 Thread djandrow

Can no one help me with this, its just these two lines:

 (r'^archive/$', date_based.archive_index,archive_info
{'template_name': 'blog/archive.html'}),
 (r'^archive/(?Pd{4})/?$',date_based.archive_year, archive_info
{'template_name': 'blog/archive.html'}),

Please?

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



Re: URLs Syntax Error

2008-09-03 Thread mccomas . chris

try it without the {}

(r'^$','archive_index', dict(archive_dict, template_name='blog/
archive.html')),

On Sep 3, 9:07 am, Daniel Hepper <[EMAIL PROTECTED]> wrote:
> > could do dict(archive_dict, {'template_name': 'blog/archive.html'} )
>
> I don't think it's that easy. I get this:
>
> >>> dict(archive_dict, {'template_name': 'blog/archive.html'} )
>
> Traceback (most recent call last):
>   File "", line 1, in 
> TypeError: dict expected at most 1 arguments, got 2
>
> The only thing that comes to my mind is:
> dict(archive_info.items() + [('template_name','blog/archive.html')] )
>
> A bit messy though.
>
> > On Sep 3, 8:40 am, Daniel Hepper <[EMAIL PROTECTED]> wrote:
> > > Adding a comma will probably not help, because you then have 5 values in
> > > the tuple, but the expected format is:
>
> > > (regular expression, Python callback function [, optional dictionary [,
> > > optional name]])
>
> > > Either you put the argument 'template_name' into the archive_info dict
> > > or you make two separate dicts.
>
> > > Daniel
>
> > > Am Mittwoch, den 03.09.2008, 05:26 -0700 schrieb
> > > [EMAIL PROTECTED]:
>
> > > > i believe you need a comma after archive_info and before
> > > > {'template_name': 'blog/archive.html'}
>
> > > > On Sep 3, 7:40 am, djandrow <[EMAIL PROTECTED]> wrote:
> > > > > Can no one help me with this, its just these two lines:
>
> > > > >  (r'^archive/$', date_based.archive_index,archive_info
> > > > > {'template_name': 'blog/archive.html'}),
> > > > >  (r'^archive/(?Pd{4})/?$',date_based.archive_year, archive_info
> > > > > {'template_name': 'blog/archive.html'}),
>
> > > > > Please?
>
> > > > > Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: URLs Syntax Error

2008-09-03 Thread Daniel Hepper


> could do dict(archive_dict, {'template_name': 'blog/archive.html'} )
I don't think it's that easy. I get this:

>>> dict(archive_dict, {'template_name': 'blog/archive.html'} )
Traceback (most recent call last):
  File "", line 1, in 
TypeError: dict expected at most 1 arguments, got 2

The only thing that comes to my mind is:
dict(archive_info.items() + [('template_name','blog/archive.html')] )

A bit messy though.


> On Sep 3, 8:40 am, Daniel Hepper <[EMAIL PROTECTED]> wrote:
> > Adding a comma will probably not help, because you then have 5 values in
> > the tuple, but the expected format is:
> >
> > (regular expression, Python callback function [, optional dictionary [,
> > optional name]])
> >
> > Either you put the argument 'template_name' into the archive_info dict
> > or you make two separate dicts.
> >
> > Daniel
> >
> > Am Mittwoch, den 03.09.2008, 05:26 -0700 schrieb
> > [EMAIL PROTECTED]:
> >
> > > i believe you need a comma after archive_info and before
> > > {'template_name': 'blog/archive.html'}
> >
> > > On Sep 3, 7:40 am, djandrow <[EMAIL PROTECTED]> wrote:
> > > > Can no one help me with this, its just these two lines:
> >
> > > >  (r'^archive/$', date_based.archive_index,archive_info
> > > > {'template_name': 'blog/archive.html'}),
> > > >  (r'^archive/(?Pd{4})/?$',date_based.archive_year, archive_info
> > > > {'template_name': 'blog/archive.html'}),
> >
> > > > Please?
> >
> > > > Andrew
> > 


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



URLs Syntax Error

2008-09-02 Thread djandrow

Hi, I have the following URLs.py

from django.conf.urls.defaults import *
from akonline.views import current_datetime
from django.views.generic import date_based
from akonline.blog.models import Category, Entry

archive_info = {
"queryset" : Entry.objects.all(),
"date_field" : "entry_date"
}

urlpatterns = patterns('',

(r'^time/$', current_datetime),
(r'^blog/$', 'akonline.blog.views.get_entries'),
(r'^test/$', 'akonline.blog.views.blog'),
(r'^blog/(?P\w+)/$',
'akonline.blog.views.category_entry'),

 # Date based URLS:

#LINE 20 Below:

 (r'^archive/$', date_based.archive_index,
archive_info {'template_name': 'blog/archive.html'}),
 (r'^archive/(?Pd{4})/?$',
date_based.archive_year, archive_info {'template_name': 'blog/
archive.html'}),

# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)

and on line 20 I get the following error:

Request Method: GET
Request URL: http://www.andrewkenyononline.net/test/
Django Version: 1.0-beta_2-SVN-8849
Python Version: 2.4.4
Installed Applications:
['akonline.blog']
Installed Middleware:
()


Traceback:
File "/home/django/django_src/django/core/handlers/base.py" in
get_response
  76. callback, callback_args, callback_kwargs =
resolver.resolve(
File "/home/django/django_src/django/core/urlresolvers.py" in resolve
  178. for pattern in self.urlconf_module.urlpatterns:
File "/home/django/django_src/django/core/urlresolvers.py" in
_get_urlconf_module
  197. self._urlconf_module =
__import__(self.urlconf_name, {}, {}, [''])

Exception Type: SyntaxError at /test/
Exception Value: invalid syntax (urls.py, line 20)

This is my first attempt at using data based views so the same error
probably occurs on line 21 as well. I would appreciate any help.

Regards,

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



Re: Unaccountable syntax error

2008-08-30 Thread Leaf

Of course. I just look at the error actually occurs on, not the
context. I guess even Python's awesome debugging still has limits.
What happened was that I forgot a parenthesis at the end of the
previous line. Thanks for giving me the tip.

On Aug 30, 9:57 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Sat, Aug 30, 2008 at 9:50 AM, Leaf <[EMAIL PROTECTED]> wrote:
>
> > I'm having a problem when I try to validate my models. The interpreter
> > somehow takes offense at this line:
>
> >box_text_color = models.ColorField("Box Text Color")
>
> > I'm using a custom "ColorField" here. What I don't understand is that
> > it seems almost identical to this ColorField, which it did accept:
>
> >bg_color = models.ColorField("Background Color")
>
> > When it rejected it, the flow looked like this:
>
> >  File "/Users/leaf/Django/devsite/../devsite/djstyles/models.py",
> > line 47
> >box_text_color = models.ColorField("Box Text Color")
> >^
> > SyntaxError: invalid syntax
>
> > The caret was pointing at the r in "box_text_color". Does anyone know
> > how this could have happened?
>
> What's on the line above that?  That's probably where the trouble begins.
>
> 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: Unaccountable syntax error

2008-08-30 Thread Karen Tracey
On Sat, Aug 30, 2008 at 9:50 AM, Leaf <[EMAIL PROTECTED]> wrote:

>
> I'm having a problem when I try to validate my models. The interpreter
> somehow takes offense at this line:
>
>box_text_color = models.ColorField("Box Text Color")
>
> I'm using a custom "ColorField" here. What I don't understand is that
> it seems almost identical to this ColorField, which it did accept:
>
>bg_color = models.ColorField("Background Color")
>
> When it rejected it, the flow looked like this:
>
>  File "/Users/leaf/Django/devsite/../devsite/djstyles/models.py",
> line 47
>box_text_color = models.ColorField("Box Text Color")
>^
> SyntaxError: invalid syntax
>
> The caret was pointing at the r in "box_text_color". Does anyone know
> how this could have happened?
>

What's on the line above that?  That's probably where the trouble begins.

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



Unaccountable syntax error

2008-08-30 Thread Leaf

I'm having a problem when I try to validate my models. The interpreter
somehow takes offense at this line:

box_text_color = models.ColorField("Box Text Color")

I'm using a custom "ColorField" here. What I don't understand is that
it seems almost identical to this ColorField, which it did accept:

bg_color = models.ColorField("Background Color")

When it rejected it, the flow looked like this:

  File "/Users/leaf/Django/devsite/../devsite/djstyles/models.py",
line 47
box_text_color = models.ColorField("Box Text Color")
^
SyntaxError: invalid syntax

The caret was pointing at the r in "box_text_color". Does anyone know
how this could have happened?
--~--~-~--~~~---~--~~
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: Unexplainable syntax error

2008-07-07 Thread Daniel Ellison

Errors like that usually indicate errors further up in your code. if
you have pasted line 10 properly, you're just missing a closing
parenthesis.

On Jul 7, 2:43 pm, Leaf <[EMAIL PROTECTED]> wrote:
> After resolving the URLConf problem, I wrote some views without
> templates to make sure that I had the syntax right. When I tried to
> visit localhost:8000/styles/css/classic-b-and-w/ again, I recieved the
> error "SyntaxError at /styles/css/classic-b-and-w/ - invalid syntax
> (views.py, line 12)". The lines in question are (from the
> aforementioned views.py):
>
> (12) def test_page(request, stylename):
> (13)ow_my_style = get_object_or_404(Style, Slug=stylename)
> (14)return render_to_response('templates/testpage.html', {title:
> ow_my_style.Style_Name, slug: ow_my_style.Slug,
> author:ow_my_style.Author})
>
> I don't see why Python has a problem with it, because it passed a
> nearly identical line (line 8):
>
> (8) def css_generate(request, stylename):
> (9)you_cant_handle_my_style = get_object_or_404(Style,
> Slug=stylename)
> (10)return render_to_response('templates/genstyle.css', {style:
> you_cant_handle_my_style}
>
> This one has me really confused. Does anyone know what could have
> happened here?
>
> Regards,
> Leaf
--~--~-~--~~~---~--~~
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: Unexplainable syntax error

2008-07-07 Thread Karen Tracey
On Mon, Jul 7, 2008 at 2:43 PM, Leaf <[EMAIL PROTECTED]> wrote:

>
> After resolving the URLConf problem, I wrote some views without
> templates to make sure that I had the syntax right. When I tried to
> visit localhost:8000/styles/css/classic-b-and-w/ again, I recieved the
> error "SyntaxError at /styles/css/classic-b-and-w/ - invalid syntax
> (views.py, line 12)". The lines in question are (from the
> aforementioned views.py):
>
> (12) def test_page(request, stylename):
> (13)ow_my_style = get_object_or_404(Style, Slug=stylename)
> (14)return render_to_response('templates/testpage.html', {title:
> ow_my_style.Style_Name, slug: ow_my_style.Slug,
> author:ow_my_style.Author})
>
> I don't see why Python has a problem with it, because it passed a
> nearly identical line (line 8):
>
> (8) def css_generate(request, stylename):
> (9)you_cant_handle_my_style = get_object_or_404(Style,
> Slug=stylename)
> (10)return render_to_response('templates/genstyle.css', {style:
> you_cant_handle_my_style}
>
> This one has me really confused. Does anyone know what could have
> happened here?


Looks like you are missing a close paren on line 10.  Syntax errors  are
often reported on lines following the one where the actual error is,
particularly when it is something missing.  The parser doesn't see a problem
until it encounters something unexpected instead of whatever it is looking
for.

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



Unexplainable syntax error

2008-07-07 Thread Leaf

After resolving the URLConf problem, I wrote some views without
templates to make sure that I had the syntax right. When I tried to
visit localhost:8000/styles/css/classic-b-and-w/ again, I recieved the
error "SyntaxError at /styles/css/classic-b-and-w/ - invalid syntax
(views.py, line 12)". The lines in question are (from the
aforementioned views.py):

(12) def test_page(request, stylename):
(13)ow_my_style = get_object_or_404(Style, Slug=stylename)
(14)return render_to_response('templates/testpage.html', {title:
ow_my_style.Style_Name, slug: ow_my_style.Slug,
author:ow_my_style.Author})

I don't see why Python has a problem with it, because it passed a
nearly identical line (line 8):

(8) def css_generate(request, stylename):
(9)you_cant_handle_my_style = get_object_or_404(Style,
Slug=stylename)
(10)return render_to_response('templates/genstyle.css', {style:
you_cant_handle_my_style}

This one has me really confused. Does anyone know what could have
happened here?

Regards,
Leaf
--~--~-~--~~~---~--~~
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: Syntax error: "can't assign to operator"

2008-07-07 Thread bruno desthuilliers


On 5 juil, 04:33, Leaf <[EMAIL PROTECTED]> wrote:
> Okay. I'll run a quick find-and-replace to set all my identifiers to
> use underscores instead of hyphens. I'm not that familiar with Python,
> so I assumed that it would recognize hyphens as a seperator and not a
> minus sign.

There are very few programming languages that allow hyphens or other
special chars in identifiers.

(snip)
> > > class Style(models.Model):
> > > Style-Name = models.CharField("Style Name", Max_length = 32,
> > > Default = "Styles Upon Styles", Help_text = "A user-friendly name for
> > > the style.")

And while we're at it, the naming conventions in Python are
"all_lower_with_underscore" for anything else than class names.
--~--~-~--~~~---~--~~
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: Syntax error: "can't assign to operator"

2008-07-04 Thread Leaf

Okay. I'll run a quick find-and-replace to set all my identifiers to
use underscores instead of hyphens. I'm not that familiar with Python,
so I assumed that it would recognize hyphens as a seperator and not a
minus sign.

Regards,
Leaf

On Jul 4, 10:27 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-07-04 at 19:24 -0700, Leaf wrote:
> > I'm still working on the models.py for Dj Styles. I'm trying to create
> > a "Style" class, and the part of my code in question looks something
> > like this:
>
> > class Style(models.Model):
> >     Style-Name = models.CharField("Style Name", Max_length = 32,
> > Default = "Styles Upon Styles", Help_text = "A user-friendly name for
> > the style.")
>
> > Before resyncing the database, I hit the "Check Syntax" button in
> > PythonWin, and it returned "syntax error - can't assign to operator
> > (models.py, line 37)". Line 37 is the one beginning with Style-Name. I
> > tried searching the Internet for the syntax error, but couldn't find
> > anything that was particularly helpful. Does anyone know what's wrong
> > with my code that could be causing this error?
>
> Python thinks "Style-Name" is "Style - Name". You cannot use hyphens in
> identifiers. Looks like you need to slow down and take care that your
> Python is valid when you see these sorts of error messages.
>
> Malcolm
--~--~-~--~~~---~--~~
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: Syntax error: "can't assign to operator"

2008-07-04 Thread Malcolm Tredinnick


On Fri, 2008-07-04 at 19:24 -0700, Leaf wrote:
> I'm still working on the models.py for Dj Styles. I'm trying to create
> a "Style" class, and the part of my code in question looks something
> like this:
> 
> class Style(models.Model):
> Style-Name = models.CharField("Style Name", Max_length = 32,
> Default = "Styles Upon Styles", Help_text = "A user-friendly name for
> the style.")
> 
> Before resyncing the database, I hit the "Check Syntax" button in
> PythonWin, and it returned "syntax error - can't assign to operator
> (models.py, line 37)". Line 37 is the one beginning with Style-Name. I
> tried searching the Internet for the syntax error, but couldn't find
> anything that was particularly helpful. Does anyone know what's wrong
> with my code that could be causing this error?

Python thinks "Style-Name" is "Style - Name". You cannot use hyphens in
identifiers. Looks like you need to slow down and take care that your
Python is valid when you see these sorts of error messages.

Malcolm



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



Syntax error: "can't assign to operator"

2008-07-04 Thread Leaf

I'm still working on the models.py for Dj Styles. I'm trying to create
a "Style" class, and the part of my code in question looks something
like this:

class Style(models.Model):
Style-Name = models.CharField("Style Name", Max_length = 32,
Default = "Styles Upon Styles", Help_text = "A user-friendly name for
the style.")

Before resyncing the database, I hit the "Check Syntax" button in
PythonWin, and it returned "syntax error - can't assign to operator
(models.py, line 37)". Line 37 is the one beginning with Style-Name. I
tried searching the Internet for the syntax error, but couldn't find
anything that was particularly helpful. Does anyone know what's wrong
with my code that could be causing this error?

Regards,
Leaf
--~--~-~--~~~---~--~~
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: Syntax Error (line out of range), get_callable, urlresolvers

2007-12-30 Thread l5x

On Dec 31, 12:19 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:

> Is 534 one past the last line of views.py?

Yes.

> I expect you have a syntax error
> such as a missing closing paren or bracket in your views.py file, which is
> causing the parser to keep scanning until it reaches the end of the file and
> then report the error on one line past the end of the file.  The error is
> probably near the end of the file.  For syntax errors you often have to look
> a little above where the error is reported to see what is really causing the
> problem.
>

Yes, I know about it, but I deleted my new parts of code and it is
still the same result. My Eclipse+PyDev doesn't show any mistakes as
well. If there is no other suggestions - I will just check my code
line by line to check what it may be.

Thank you.

Best regards,
l.
--~--~-~--~~~---~--~~
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: Syntax Error (line out of range), get_callable, urlresolvers

2007-12-30 Thread Karen Tracey
On Dec 30, 2007 5:42 PM, l5x <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I get the following error:
>
> Django Version: 0.97-pre-SVN-6976
> Python Version: 2.5.1
> Exception Type: SyntaxError
> Exception Value:invalid syntax (views.py, line 534)
> Exception Location: /home/user/django_src/django/core/urlresolvers.py
> in get_callable, line 47
>
> Traceback:
> [snipped]
> Exception Type: SyntaxError at /
> Exception Value: invalid syntax (views.py, line 534)
>
> Interesting thing is that line (534) is out of range...
>

Is 534 one past the last line of views.py?  I expect you have a syntax error
such as a missing closing paren or bracket in your views.py file, which is
causing the parser to keep scanning until it reaches the end of the file and
then report the error on one line past the end of the file.  The error is
probably near the end of the file.  For syntax errors you often have to look
a little above where the error is reported to see what is really causing the
problem.

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



Syntax Error (line out of range), get_callable, urlresolvers

2007-12-30 Thread l5x

Hello,

I get the following error:

Django Version: 0.97-pre-SVN-6976
Python Version: 2.5.1
Exception Type: SyntaxError
Exception Value:invalid syntax (views.py, line 534)
Exception Location: /home/user/django_src/django/core/urlresolvers.py
in get_callable, line 47

Traceback:
File "/home/user/django_src/django/core/handlers/base.py" in
get_response
  73. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "/home/user/django_src/django/core/urlresolvers.py" in resolve
  233. sub_match = pattern.resolve(new_path)
File "/home/user/django_src/django/core/urlresolvers.py" in resolve
  172. return self.callback, args, kwargs
File "/home/user/django_src/django/core/urlresolvers.py" in
_get_callback
  178. self._callback = get_callable(self._callback_str)
File "/home/user/django_src/django/utils/functional.py" in wrapper
  18. result = func(*args)
File "/home/user/django_src/django/core/urlresolvers.py" in
get_callable
  47. lookup_view = getattr(__import__(mod_name, {},
{}, ['']), func_name)

Exception Type: SyntaxError at /
Exception Value: invalid syntax (views.py, line 534)

Interesting thing is that line (534) is out of range...

When I'm trying to visit admin page, I get Syntax Error with the same
line and:

Traceback:
File "/home/user/django_src/django/core/handlers/base.py" in
get_response
  82. response = callback(request, *callback_args,
**callback_kwargs)
File "/home/user/django_src/django/contrib/admin/views/decorators.py"
in _checklogin
  66. return _display_login_form(request, message)
File "/home/user/django_src/django/contrib/admin/views/decorators.py"
in _display_login_form
  29. }, context_instance=template.RequestContext(request))
File "/home/user/django_src/django/template/context.py" in __init__
  102. for processor in get_standard_processors() +
processors:
File "/home/user/django_src/django/template/context.py" in
get_standard_processors
  78. mod = __import__(module, {}, {}, [attr])

What do you think about it?

Best regards,
l.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Syntax error in file upload

2007-10-05 Thread jacoberg2

Hey,

I've been working on this view for a while and I keep hitting road
blocks,
the newest one actually hits the save method in my view, but stops on
a weird syntax error.
This is the traceback.

Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/auth/
decorators.py" in _checklogin
  14. return view_func(request, *args, **kwargs)
File "/opt/vidars/cns/vidars/views/pro.py" in bulk_reg
  100. fi.save()
File "/usr/lib/python2.4/site-packages/django/db/models/base.py" in
save
  204. ','.join(placeholders)), db_values)
File "/usr/lib/python2.4/site-packages/django/db/backends/util.py" in
execute
  12. return self.cursor.execute(sql, params)

  ProgrammingError at /provider/dataset/bulkreg/
  ERROR: syntax error at or near "{" at character 82 INSERT INTO
"vidars_bulkdataregfile" ("user_id","domain_id","bulk") VALUES (10,9,
{'content': '[ac.brms]\ntype: timeseries\nurl:
http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date:
1997-08-27\nend_date: 200-12-18\nmetadata: These data have been
scraped from the NASA/CDAWEB website:\n 
http://cdaweb.gsfc.nasa.gov/cdaweb/istp_public/\n
They are only meant for internal use and VIDARS testing.\n Use at your
own risk! Jimmy Raeder [EMAIL PROTECTED]:
timeseries\nurl: http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date:
1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been
scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/
\n\t cdaweb/istp_public/ \n They are only meant for internal use and
VIDARS\n\t testing.Use at your own risk! Jimmy Raeder\n\n[ac.bygse]
\ntype: timeseries\nurl: 
http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date:
1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been
scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/
\n\t cdaweb/istp_public/ \n They are only meant for internal use and
VIDARS\n\t testing.Use at your own risk! Jimmy Raeder\n\n\n[ac.bzgse]
\ntype: timeseries\nurl: 
http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date:
1997-08-27\nend_date: 2004-12-31\nmetadata: These data have been
scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/
\n\t cdaweb/istp_public/ \n They are only meant for internal use and
VIDARS\n\t testing.Use at your own risk! Jimmy Raeder \n\n[ac.he-rat]
\ntype: timeseries\nurl: 
http://terra.sr.unh.edu/cgi-bin/dataserver.pl\nstart_date:
1998-11-01\nend_date: 2000-07-31\nmetadata: These data have been
scraped from the NASA/\n\t CDAWEB website:http://cdaweb.gsfc.nasa.gov/
\n\t cdaweb/istp_public/ \n They are only meant for internal use and
VIDARS\n\t testing.Use at your own risk! Jimmy Raeder \n', 'content-
type': 'application/octet-stream', 'filename': 'testfile.ini'})


This is suppose to be a file upload view and this is the following
code for it:

@login_required
def bulk_reg(request):
"""Add large numbers of registrations by uploading a file"""
manipulator = FileManipulator()
data_domain = get_object_or_404(DataDomain, user=request.user.id)
new_data = {}
errors = {}

if request.POST or request.FILES:
new_data = request.POST.copy()
new_data.update(request.FILES)
errors = manipulator.get_validation_errors(new_data)

if not errors:
manipulator.do_html2python(new_data)

fi = BulkDataRegFile(user = request.user,
 domain = data_domain,
 bulk = new_data['bulk'],)
fi.save()

return HttpResponseRedirect('/provider/')

form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('provider/dataset/bulkreg.dht',
  {'form': form},
 
context_instance=RequestContext(request),)

and this is the file manipulator that i made for this view

class FileManipulator(forms.Manipulator):

def __init__(self):
self.fields = (

forms.FileUploadField(field_name="bulk",
is_required=True),

)

so is there something im missing or is actually tweeking out about the
type of file it is,
the file upload works perfectly fine when i use it in the admin
interface.

Thanks for the help.

Jacob


--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-09-06 Thread David Reynolds


On 6 Sep 2007, at 11:06 am, b3n wrote:

> I wasn't sure if the syntax was different for Unix/Windows. I think it
> would be helpful if the tutorial made a statement to that effect.

Surely not saying anything implies that there are no differences  
between the two?

-- 
David Reynolds
[EMAIL PROTECTED]



--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-09-06 Thread b3n

I wasn't sure if the syntax was different for Unix/Windows. I think it
would be helpful if the tutorial made a statement to that effect.


On 29 Aug, 23:39, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
> On Aug 29, 11:06 pm, b3n <[EMAIL PROTECTED]> wrote:
>
> > Hey I managed to get Apache to find Django!
>
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > PythonPath "['C:\Python'] + sys.path"
> > SetEnv DJANGO_SETTINGS_MODULE bookmarks.settings
> > PythonDebug On
> > 
>
> > Now I get a nice Django-styled error instead of the crappymod_python
> > one ;)
>
> And to make it clear to others what the problem was, you weren't
> setting PythonPath correctly as per the documentation. Ie., you were
> missing the fact that you had to add to sys.path and not replace it.
>
> 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: Apache + Django - syntax error

2007-08-29 Thread Graham Dumpleton

On Aug 29, 11:06 pm, b3n <[EMAIL PROTECTED]> wrote:
> Hey I managed to get Apache to find Django!
>
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> PythonPath "['C:\Python'] + sys.path"
> SetEnv DJANGO_SETTINGS_MODULE bookmarks.settings
> PythonDebug On
> 
>
> Now I get a nice Django-styled error instead of the crappymod_python
> one ;)

And to make it clear to others what the problem was, you weren't
setting PythonPath correctly as per the documentation. Ie., you were
missing the fact that you had to add to sys.path and not replace it.

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: Apache + Django - syntax error

2007-08-29 Thread b3n

Ahh never mind.

I hadn't started the MySQL server. Doh.


--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-08-29 Thread b3n

Hey I managed to get Apache to find Django!


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['C:\Python'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE bookmarks.settings
PythonDebug On


Now I get a nice Django-styled error instead of the crappy mod_python
one ;)

OperationalError at /
(2003, "Can't connect to MySQL server on 'localhost' (10061)")

Sooo... where do I setup the db? Shouldn't that be left to my project?



--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-08-29 Thread b3n

Still says a syntax error when I navigate to http://localhost/

MOD_PYTHON ERROR

ProcessId:  1420
Interpreter:'localhost'

ServerName: 'localhost'
DocumentRoot:   'C:/xampp/htdocs'

URI:'/'
Location:   '/'
Directory:  None
Filename:   'C:/xampp/htdocs/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):
  File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
  File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1186, in _process_target
newpath = eval(pathstring)
  File "", line 1
C:\Python
 ^
SyntaxError: invalid syntax


--~--~-~--~~~---~--~~
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: Apache + Django - syntax error

2007-08-29 Thread daev

Try simple:
PythonPath "C:\Python"


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



Apache + Django - syntax error

2007-08-29 Thread b3n

I'm trying to get Django working on my local Apache (v2). I'm on
Windows XP.


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE bookmarks.settings
PythonDebug On
PythonPath "C:\Python\bookmarks"


If I take out PythonPath I get even more traceback and the following
error:

"EnvironmentError: Could not import settings 'bookmarks.settings' (Is
it on sys.path? Does it have syntax errors?): No module named
bookmarks.settings"

What is the PythonPath meant to point to?

My Python code is in C:\Python.
My Python installation is in C:\Python25\
The location of python.exe is on my system PATH


--~--~-~--~~~---~--~~
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: Syntax error with render_to_response call

2007-01-25 Thread Tipan

Hi Christian,

I think you are right, I was using a PHP IDE as my editor and when I
reverted to Notepad, it showed a different layout. I modified it and it
worked fine. Really frustrating and such a waste of time.

Is there a popular IDE that makes editing quick and easy?

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: Syntax error with render_to_response call

2007-01-25 Thread Christian Joergensen
Tipan wrote:
> def codeview(request):
> manipulator = CodeViewManipulator()
> if request.method == 'POST':
> new_data = request.POST.copy()
> errors = manipulator.get_validation_errors(new_data)
>   if not errors:
> 
>   return HttpResponseRedirect("/hive/codeoutput/")
> else:
> errors = new_data = {}
> code_list=CodeTest.objects.all()
> return render_to_response('codeview.html', {'code_list':code_list})
> 
> This always generates a Django Syntax Error on the return
> render_to_response line. I can define a new view with just the last two
> lines and it works fine. The function also runs if I substitute a
> return HttpResponse line instead of the render_to_response, but then it
> won't display my html template page.
> 
> Is there some ruling preventing me from using render_to_response in
> this way?
> 
> Any advice welcome - it's driving me crazy!

Could it be a case of tab vs. spaces indentation? What more that Syntax
Error does the django error page tell you?

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  | Visit us at: http://www.gmta.info



signature.asc
Description: OpenPGP digital signature


Syntax error with render_to_response call

2007-01-25 Thread Tipan

I have a problem that is causing me some grief and I can't seem to
found a reason for it. I'm relatively new to Django and Python so it is
likely to be something simple.

I have a function that displays a form and some data from a table. If
the form data is correct, it generates some new lines of data in the
table and displays another page. However, I get a Syntax error from my
render_to_response line in the function. Code is as follows in View.py:

def codeview(request):
manipulator = CodeViewManipulator()
if request.method == 'POST':
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:

return HttpResponseRedirect("/hive/codeoutput/")
else:
errors = new_data = {}
code_list=CodeTest.objects.all()
return render_to_response('codeview.html', {'code_list':code_list})

This always generates a Django Syntax Error on the return
render_to_response line. I can define a new view with just the last two
lines and it works fine. The function also runs if I substitute a
return HttpResponse line instead of the render_to_response, but then it
won't display my html template page.

Is there some ruling preventing me from using render_to_response in
this way?

Any advice welcome - it's driving me crazy!


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



get_absolute_url syntax error ?

2006-11-13 Thread Kamil Wdowicz

class Page(models.Model):
title = models.CharField(maxlength=200)
pub_date = models.DateTimeField('Publication date')
content = models.TextField(blank=True)
category = models.ForeignKey(Category, blank=True)
seo = models.ForeignKey(Seo, blank=True)
slug = models.SlugField('adress URL', prepopulate_from=("title",))
in_menu = models.BooleanField()

(line:35)def get_absolute_url(self):
 return "/p/%s/" % self.slug

Syntax Error in line 35 hmm who can help me ?
Its not about indent,

Greets

--~--~-~--~~~---~--~~
 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: syntax error with tutorial1 in "python manage.py sql polls" step

2006-03-25 Thread bruno modulix

maphew a écrit :
> Hi, at the ''python manage.py sql polls'' step of the
> [http://www.djangoproject.com/documentation/tutorial1/ poll tutorial] I
> get a syntax error:

(snip)
> mod = __import__('django.models.%s' % submodule, '', '', [''])
>   File "/home/matt/code/djtutor/../djtutor/polls/models/polls.py", line
> 12
> 
>   ^
> SyntaxError: invalid syntax
> 
(snip)
> 
> any idea what I've done wrong?

Not exactly, but the problem is about a syntax error near line 12 of 
file /home/matt/code/djtutor/../djtutor/polls/models/polls.py !-)

You could probably check this first, then post the relevant code if you 
can't find the 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
-~--~~~~--~~--~--~---



syntax error with tutorial1 in "python manage.py sql polls" step

2006-03-24 Thread maphew

Hi, at the ''python manage.py sql polls'' step of the
[http://www.djangoproject.com/documentation/tutorial1/ poll tutorial] I
get a syntax error:

{{{
[EMAIL PROTECTED]:~/code/djtutor$ python manage.py sql polls
Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1051, in execute_manager
execute_from_command_line(action_mapping)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1017, in execute_from_command_line
mod_list = [meta.get_app(app_label) for app_label in args[1:]]
  File "/usr/lib/python2.4/site-packages/django/core/meta/__init__.py",
line 76, in get_app
return __import__('%s.%s' % (MODEL_PREFIX, app_label), '', '',
[''])
  File "/usr/lib/python2.4/site-packages/django/models/__init__.py",
line 13, in ?
modules = meta.get_installed_model_modules(__all__)
  File "/usr/lib/python2.4/site-packages/django/core/meta/__init__.py",
line 111, in get_installed_model_modules
mod = __import__('django.models.%s' % submodule, '', '', [''])
  File "/home/matt/code/djtutor/../djtutor/polls/models/polls.py", line
12

  ^
SyntaxError: invalid syntax
}}}

if I remove the poll addition to the INSTALLED_APPS section of
settings.py, it works again:

Works:
{{{
INSTALLED_APPS = (
)
}}}

Doesn't:
{{{
INSTALLED_APPS = (
'djtutor.polls',
)
}}}

any idea what I've done wrong?


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



<    1   2