Re: optional parameter url

2009-02-27 Thread Adonis

ok,

seems i found a quick n dirty way to overcome the broken pipe.
I just left it like this,
*
(r'^appname/mainpage/(.*)/(?P.*)$', 'django.views.static.serve',
{'document_root': '/mesa'})
*
and it loads the static files EXCEPT some images that where in a
separate folder--> "mesa/images/sth.jpg".

If you have sth to add be my guests!
thanks again!

On Feb 26, 11:58 am, Adonis  wrote:
> Thank you for your replies,
>
> Kevin,
> Adding a slash does no good when it comes to calling static files
> using serve(). It works different than the regexp for calling a def
> from views.py because it searches for directories, file extensions
> etc.
>
> Raffaele,
> swaping the lines produces an "error 32, broken pipe".
> I have been trying to figure out why but i did not find anything yet.
> The parameters though are read and printed. I can not manage to do sth
> with Error handling.
>
> Any further suggestions?
>
> On Feb 25, 7:23 pm, Raffaele Salmaso 
> wrote:
>
> > Adonis wrote:
> > > (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
> > > {'document_root': '/mesa'}),
>
> > this takes *everything* as 'path'> 
> > (r'^appname/mainpage/(?P\d+)/(?P.*)$',
> > > 'django.views.static.serve', {'document_root': '/mesa'}),
>
> > this takes only digits as 'xexe', but it never get called because it
> > cames after .*
>
> > swap them as
> > (r'^appname/mainpage/(?P\d+)/(?P.*)$',
> >  'django.views.static.serve', {'document_root': '/mesa'}),
> > (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
> >  {'document_root': '/mesa'}),
>
> > --
> > ()_() | That said, I didn't actually _test_ my patch.      | +
> > (o.o) | That's what users are for!                         | +---+
> > 'm m' |                                   (Linus Torvalds) |  O  |
> > (___) |                      raffaele at salmaso punto org |
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: optional parameter url

2009-02-26 Thread Adonis

Thank you for your replies,

Kevin,
Adding a slash does no good when it comes to calling static files
using serve(). It works different than the regexp for calling a def
from views.py because it searches for directories, file extensions
etc.

Raffaele,
swaping the lines produces an "error 32, broken pipe".
I have been trying to figure out why but i did not find anything yet.
The parameters though are read and printed. I can not manage to do sth
with Error handling.

Any further suggestions?

On Feb 25, 7:23 pm, Raffaele Salmaso 
wrote:
> Adonis wrote:
> > (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
> > {'document_root': '/mesa'}),
>
> this takes *everything* as 'path'> 
> (r'^appname/mainpage/(?P\d+)/(?P.*)$',
> > 'django.views.static.serve', {'document_root': '/mesa'}),
>
> this takes only digits as 'xexe', but it never get called because it
> cames after .*
>
> swap them as
> (r'^appname/mainpage/(?P\d+)/(?P.*)$',
>  'django.views.static.serve', {'document_root': '/mesa'}),
> (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
>  {'document_root': '/mesa'}),
>
> --
> ()_() | That said, I didn't actually _test_ my patch.      | +
> (o.o) | That's what users are for!                         | +---+
> 'm m' |                                   (Linus Torvalds) |  O  |
> (___) |                      raffaele at salmaso punto org |
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: optional parameter url

2009-02-25 Thread Raffaele Salmaso

Adonis wrote:
> (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
> {'document_root': '/mesa'}),
this takes *everything* as 'path'
> (r'^appname/mainpage/(?P\d+)/(?P.*)$',
> 'django.views.static.serve', {'document_root': '/mesa'}),
this takes only digits as 'xexe', but it never get called because it
cames after .*

swap them as
(r'^appname/mainpage/(?P\d+)/(?P.*)$',
 'django.views.static.serve', {'document_root': '/mesa'}),
(r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
 {'document_root': '/mesa'}),

-- 
()_() | That said, I didn't actually _test_ my patch.  | +
(o.o) | That's what users are for! | +---+
'm m' |   (Linus Torvalds) |  O  |
(___) |  raffaele at salmaso punto org |

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



Re: optional parameter url

2009-02-25 Thread Kevin Audleman

I think you're missing the trailing slash in your URL's. Should be:

(r'^appname/mainpage/(?P.*)/$', 'django.views.static.serve',
 {'document_root': '/mesa'}),
(r'^appname/mainpage/(?P\d+)/(?P.*)/$',
 'django.views.static.serve', {'document_root': '/mesa'}),

Mind you, I don't know if this will fix anything...

Kevin


On Feb 25, 4:26 am, Adonis  wrote:
> Hello,
> I am having some trouble serving static files when i try to pass an
> optional parameter.
> For url: appname.mainpage/, the static files work fine
> For url: appname.mainpage/10/, the static files are not read.
>
> **
> url.py
>
> (r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
> {'document_root': '/mesa'}),
> (r'^appname/mainpage/(?P\d+)/(?P.*)$',
> 'django.views.static.serve', {'document_root': '/mesa'}),
>
> views.py
>
> def mainpage(request, xexe=0):
>     print "optional parameter: ", xexe
>     return render_to_response('mesa/blah.html', {...some args...})
> **
>
> Any suggestions my respectful django users?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



optional parameter url

2009-02-25 Thread Adonis

Hello,
I am having some trouble serving static files when i try to pass an
optional parameter.
For url: appname.mainpage/, the static files work fine
For url: appname.mainpage/10/, the static files are not read.

**
url.py

(r'^appname/mainpage/(?P.*)$', 'django.views.static.serve',
{'document_root': '/mesa'}),
(r'^appname/mainpage/(?P\d+)/(?P.*)$',
'django.views.static.serve', {'document_root': '/mesa'}),

views.py

def mainpage(request, xexe=0):
print "optional parameter: ", xexe
return render_to_response('mesa/blah.html', {...some args...})
**

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