I want to pass the Exception info from Http404 to handler404 view and consequently the 404.html

2011-10-30 Thread Kiril
Hello guys,

in the past few months I have been developing a simple web site using
Django. I found Django amazing and mature framework for my needs. I am
now about to publish it in public hosting.

To my dismay the erro info I have included in Http404 calls is wasted
by Django and cannot make it's way ot the handler404 and consequently
to the 404.html template.

Here is example code from my views.py:

#is user logged in
  if not request.user.is_authenticated():
raise Http404(_("It is not allowed to post anonymous comments"))

Now I want to display the localized message in the 404.html but it
seems this does not make it to the handler404 view.

Here is what I found in the Django sources -
django.core.handlers.base.get_response:

except http.Http404, e:
logger.warning('Not Found: %s' % request.path,
extra={
'status_code': 404,
'request': request
})
if settings.DEBUG:
from django.views import debug
response = debug.technical_404_response(request,
e)
else:
try:
callback, param_dict = resolver.resolve404()
response = callback(request, **param_dict)
except:


As can be clealry seen the exception "e" is only passed ot the DEBUG
handler but no to the production one "callback".

My feature request is to add keyword argument param_dict "exception"
with the value of the Http404 exception "e" that is passed over to the
handler404 code. I can make this fix in my local deployment but it is
not possible to edit my hodting provider Django instance.

This will help communicate the details of the 404 errors to end users.
Same could be applied few lines below in the handler for
exceptions.PermissionDenied.

I hope this resonates with the development concepts of Django and this
small fix can make its way in to follow on release.




-Kiril K

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



Re: I've made good progress in porting Django to Python 3, and could use some help!

2011-11-27 Thread Kiril Vladimirov
Have you made some sort of TODO list I could use? 
Or selecting some failing test and make it run fine would be fine as well?

Also, how about moving this project to GitHub? 
Django is there, too(https://github.com/django/) and I thing we could find 
more participants.

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



Re: New feature: Defining fieldsets in form class (Ticket #17301)

2011-11-27 Thread Kiril Vladimirov
+1

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



Re: I've made good progress in porting Django to Python 3, and could use some help!

2011-11-28 Thread Kiril Vladimirov
My point was the social factor. I mean the GitHub community is quite 
bigger. It's not big issue if we're using mercurial instead of git. Sure, I 
prefer git, it's faster and stuff, but it's not a big deal, right now. 

Anyway, I'm trying to get into making the tests run and if I see some 
result from my work, will try to figure out some sync between github and 
bitbucket.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/RJymGD-0e68J.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Django 1.4 roadmap

2011-11-29 Thread Kiril Vladimirov

   
   - *Release version 1.4.*
   - *Move to Git/GitHub.* I


Now, that's a start!

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/4FphI_ZyTYUJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Django 1.4 alpha on December 22nd

2011-12-15 Thread Kiril Vladimirov
While I'm reading all topics, listed below I'm thinking... is it too early 
to announce **experimental** Python 3.2 support in Django 1.4?

   - Python 3 port - all tests now pass on 2.5.4, 2.6.2, 2.7.2 and 3.2.2 
   with the same codebase 

   - Python 3 port - all MySQL tests now pass on 2.6.7 and 3.2.2 with the 
   same codebase 

   - Python 3 port - all PostgreSQL tests now pass on 2.7.2 and 3.2.2 with 
   the same codebase 

   - Python 3 port - all Oracle tests (bar one) now pass on 2.7.2 and 3.2.2 
   with the same codebase 


May be something like a light bulb that should go over the head of all 
django users(as in web developers using django) and plugin maintainers 
about python 3 support could facilitate a future 2 to 3 migration.

What do you think?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/nQT-3UYcO8IJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: I think adding a "first" method to the QuerySet be useful.

2012-07-03 Thread Kiril Vladimirov

We shouldn't bloat the API. Obviously there are nice looking approaches and 
not to mention the different behaviour in some of them. 
-1 on this proposal from me.

On Tuesday, July 3, 2012 8:22:59 AM UTC+3, Łukasz Rekucki wrote:
>
> On 3 July 2012 06:27, Maxime Haineault  wrote: 
> > One of the common pitfall I come across way to often with novices is 
> > something like this: 
> > 
> > def getFirstUser(): 
> > return User.objects.all()[0] 
> > 
> > It looks innocuous and often wont raise any exceptions in dev because 
> you 
> > develop and test with data, 
> > so they slip easily in production. 
> > 
> > def getFirstUser(): 
> > return User.objects.all().first() 
> > 
> > If the QuerySet is empty it should just return None instead of raising 
> an 
> > exception. 
> > 
> > Other methods like .last() could probably also be useful, but getting 
> the 
> > first element of a QuerySet 
> > is the pitfall I see the most often. 
> > 
> > Surprise Poney Quizz: which is the fastest way to get the first object 
> of a 
> > QuerySet ? 
> > 
> > A) Using count: 
> > 
> > qs = User.objects.all() 
> > if qs.count() > 0: 
> > return qs[0] 
> > else: 
> > return None 
> > 
> > B) Convert to list: 
> > 
> > r = list(qs[:1]) 
> > if r: 
> >   return r[0] 
> > return None 
> > 
> > 
> > C) Using len: 
> > 
> > qs = User.objects.all() 
> > if len(qs) > 0: 
> > return qs[0] 
> > else: 
> > return None 
> > 
> > D) Try/except: 
> > 
> > qs = User.objects.all() 
> > try: 
> > return qs[0] 
> > except IndexError: 
> > return None 
> > 
>
> E) Use __bool__ which fetches only one batch (depends on DB): 
>
> qs = User.objects.all() 
> user = None if not qs else qs[0] 
>
> F) Use the iterator protocol 
>
> user = next(iter(User.objects.all()), None) # you can add LIMIT or 
> not, see Alex's comment 
>
> -- 
> Łukasz Rekucki 
>

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



Re: Python 3 and you

2011-11-09 Thread Kiril Vladimirov
@Jannis Leidel, is there some plan, tasks or something for new contributors 
and how could I(python developer and django user) help?



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