Re: How i can get username into the error mail?

2011-03-16 Thread emonk
thanks Margie, I already did with the info you gave me Tom.

2011/3/16 Margie Roginski 

> I found the basics for this by googling around, and I can't remember
> where I got it, but thanks to whomever gave me the basics because it
> is very useful.  Put this in your middleware and it will make the mail
> that you receive have the name of the user and their email:
>
> class ExceptionUserInfoMiddleware(object):
>"""
>Adds user details to request context on receiving an exception, so
> that they show up in the error emails.
>Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on
> top if possible). This allows
>it to catch exceptions in other middlewares as well.
>
>"""
>
>def process_exception(self, request, exception):
>"""
>Process the exception.
>
>:Parameters:
>- `request`: request that caused the exception
>- `exception`: actual exception being raised
>"""
>
>try:
> if request.user.is_authenticated():
> request.META['USERNAME'] = str(request.user.username)
>request.META['USER_EMAIL'] = str(request.user.email)
>else:
>request.META['USERNAME'] = "UNKNOWN"
>request.META['USER_EMAIL'] = "UNKNOWN"
>except:
>request.META['USERNAME'] = "UNKNOWN"
>request.META['USER_EMAIL'] = "UNKNOWN"
>pass
>
> And for the record, I of course agree that being able to google and
> then adapt things is very important.  But this is a common need so it
> seems worthwhile to post it explicitly to help the django community.
>
> Margie
>
>
> On Mar 16, 11:49 am, Shawn Milochik  wrote:
> > On Wed, Mar 16, 2011 at 2:47 PM, emonk  wrote:
> > > I'm tired of searching and found many examples of middleware but not
> the one
> > > I seek
> >
> > You almost certainly will not find the exact code you need to cut &
> > paste. You need to read the examples you did find and learn something.
> > Use that knowledge to write what you need. That's what the rest of us
> > do.
> >
> > Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread emonk
The only one who respone me an good help is Tom Evans. The rest just
repeats like
a parrot what is in the documentation; please before you say "seach in
google" say nothing is better.

2011/3/16 Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk>

> (last email, as i dont want to drag this out any more)
>
> I don't mean it in a nasty way, but I'm so sick and tired of lazy
> developers. Solving problems should be one of the best percs of the job for
> a coder.
>
> If this was something really complex, then I'd understand, but it's not.
> This is a *very* simple piece of functionality, which has plenty of public
> documentation.
>
> On Wed, Mar 16, 2011 at 6:50 PM, emonk  wrote:
>
>> aamh ok
>>
>>
>> 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk>
>>
>>> Then this isn't the job for you. Simple.
>>>
>>> On Wed, Mar 16, 2011 at 6:47 PM, emonk  wrote:
>>>
 I'm tired of searching and found many examples of middleware but not the
 one I seek

 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
 cal.leem...@simplicitymedialtd.co.uk>

 Actually, I've gotta side with Shawn on this one.
>
> There are *TONS* of examples of how to do this, I know this because I
> created one and put it on djangosnippets. :S
>
> If two people are telling you there are answers on Google, then trust
> me, there are.
>
> If you can't find them, then perhaps this isn't the job for you?
>
> On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:
>
>> I repeat, i dont have found (in all entire internet) midlleware
>> classes about email error.
>> Thanks, dont need to be a troll :)
>>
>>
>> 2011/3/16 Shawn Milochik 
>>
>>> On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
>>> > Yep, but i need an example and I have not found any.
>>> >
>>>
>>> If you haven't found any then you haven't looked. Have you heard of
>>> Google?
>>>
>>> Here are the docs:
>>>
>>> http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware
>>>
>>> For a full working example of middleware that modifies the request,
>>> do
>>> a Google search for "django middleware" and click the link for
>>> "Chapter 16: Middleware" of "The Django Book."
>>>
>>> Shawn
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

>>>
>>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread Margie Roginski
I found the basics for this by googling around, and I can't remember
where I got it, but thanks to whomever gave me the basics because it
is very useful.  Put this in your middleware and it will make the mail
that you receive have the name of the user and their email:

class ExceptionUserInfoMiddleware(object):
"""
Adds user details to request context on receiving an exception, so
that they show up in the error emails.
Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on
top if possible). This allows
it to catch exceptions in other middlewares as well.

"""

def process_exception(self, request, exception):
"""
Process the exception.

:Parameters:
- `request`: request that caused the exception
- `exception`: actual exception being raised
"""

try:
if request.user.is_authenticated():
request.META['USERNAME'] = str(request.user.username)
request.META['USER_EMAIL'] = str(request.user.email)
else:
request.META['USERNAME'] = "UNKNOWN"
request.META['USER_EMAIL'] = "UNKNOWN"
except:
request.META['USERNAME'] = "UNKNOWN"
request.META['USER_EMAIL'] = "UNKNOWN"
pass

And for the record, I of course agree that being able to google and
then adapt things is very important.  But this is a common need so it
seems worthwhile to post it explicitly to help the django community.

Margie


On Mar 16, 11:49 am, Shawn Milochik  wrote:
> On Wed, Mar 16, 2011 at 2:47 PM, emonk  wrote:
> > I'm tired of searching and found many examples of middleware but not the one
> > I seek
>
> You almost certainly will not find the exact code you need to cut &
> paste. You need to read the examples you did find and learn something.
> Use that knowledge to write what you need. That's what the rest of us
> do.
>
> Shawn

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



Re: How i can get username into the error mail?

2011-03-16 Thread Cal Leeming [Simplicity Media Ltd]
(last email, as i dont want to drag this out any more)

I don't mean it in a nasty way, but I'm so sick and tired of lazy
developers. Solving problems should be one of the best percs of the job for
a coder.

If this was something really complex, then I'd understand, but it's not.
This is a *very* simple piece of functionality, which has plenty of public
documentation.

On Wed, Mar 16, 2011 at 6:50 PM, emonk  wrote:

> aamh ok
>
>
> 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk>
>
>> Then this isn't the job for you. Simple.
>>
>> On Wed, Mar 16, 2011 at 6:47 PM, emonk  wrote:
>>
>>> I'm tired of searching and found many examples of middleware but not the
>>> one I seek
>>>
>>> 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
>>> cal.leem...@simplicitymedialtd.co.uk>
>>>
>>> Actually, I've gotta side with Shawn on this one.

 There are *TONS* of examples of how to do this, I know this because I
 created one and put it on djangosnippets. :S

 If two people are telling you there are answers on Google, then trust
 me, there are.

 If you can't find them, then perhaps this isn't the job for you?

 On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:

> I repeat, i dont have found (in all entire internet) midlleware classes
> about email error.
> Thanks, dont need to be a troll :)
>
>
> 2011/3/16 Shawn Milochik 
>
>> On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
>> > Yep, but i need an example and I have not found any.
>> >
>>
>> If you haven't found any then you haven't looked. Have you heard of
>> Google?
>>
>> Here are the docs:
>>
>> http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware
>>
>> For a full working example of middleware that modifies the request, do
>> a Google search for "django middleware" and click the link for
>> "Chapter 16: Middleware" of "The Django Book."
>>
>> Shawn
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>


>>>
>>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread Shawn Milochik
On Wed, Mar 16, 2011 at 2:47 PM, emonk  wrote:
> I'm tired of searching and found many examples of middleware but not the one
> I seek
>

You almost certainly will not find the exact code you need to cut &
paste. You need to read the examples you did find and learn something.
Use that knowledge to write what you need. That's what the rest of us
do.

Shawn

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



Re: How i can get username into the error mail?

2011-03-16 Thread emonk
aamh ok

2011/3/16 Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk>

> Then this isn't the job for you. Simple.
>
> On Wed, Mar 16, 2011 at 6:47 PM, emonk  wrote:
>
>> I'm tired of searching and found many examples of middleware but not the
>> one I seek
>>
>> 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk>
>>
>> Actually, I've gotta side with Shawn on this one.
>>>
>>> There are *TONS* of examples of how to do this, I know this because I
>>> created one and put it on djangosnippets. :S
>>>
>>> If two people are telling you there are answers on Google, then trust me,
>>> there are.
>>>
>>> If you can't find them, then perhaps this isn't the job for you?
>>>
>>> On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:
>>>
 I repeat, i dont have found (in all entire internet) midlleware classes
 about email error.
 Thanks, dont need to be a troll :)


 2011/3/16 Shawn Milochik 

> On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
> > Yep, but i need an example and I have not found any.
> >
>
> If you haven't found any then you haven't looked. Have you heard of
> Google?
>
> Here are the docs:
>
> http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware
>
> For a full working example of middleware that modifies the request, do
> a Google search for "django middleware" and click the link for
> "Chapter 16: Middleware" of "The Django Book."
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To post to this group, send email to django-users@googlegroups.com.
 To unsubscribe from this group, send email to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>
>>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread Cal Leeming [Simplicity Media Ltd]
Then this isn't the job for you. Simple.

On Wed, Mar 16, 2011 at 6:47 PM, emonk  wrote:

> I'm tired of searching and found many examples of middleware but not the
> one I seek
>
> 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk>
>
> Actually, I've gotta side with Shawn on this one.
>>
>> There are *TONS* of examples of how to do this, I know this because I
>> created one and put it on djangosnippets. :S
>>
>> If two people are telling you there are answers on Google, then trust me,
>> there are.
>>
>> If you can't find them, then perhaps this isn't the job for you?
>>
>> On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:
>>
>>> I repeat, i dont have found (in all entire internet) midlleware classes
>>> about email error.
>>> Thanks, dont need to be a troll :)
>>>
>>>
>>> 2011/3/16 Shawn Milochik 
>>>
 On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
 > Yep, but i need an example and I have not found any.
 >

 If you haven't found any then you haven't looked. Have you heard of
 Google?

 Here are the docs:

 http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware

 For a full working example of middleware that modifies the request, do
 a Google search for "django middleware" and click the link for
 "Chapter 16: Middleware" of "The Django Book."

 Shawn

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


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

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



Re: How i can get username into the error mail?

2011-03-16 Thread emonk
Thanks for the answers.
topic closed to me

2011/3/16 emonk 

> I'm tired of searching and found many examples of middleware but not the
> one I seek
>
> 2011/3/16 Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk>
>
> Actually, I've gotta side with Shawn on this one.
>>
>> There are *TONS* of examples of how to do this, I know this because I
>> created one and put it on djangosnippets. :S
>>
>> If two people are telling you there are answers on Google, then trust me,
>> there are.
>>
>> If you can't find them, then perhaps this isn't the job for you?
>>
>> On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:
>>
>>> I repeat, i dont have found (in all entire internet) midlleware classes
>>> about email error.
>>> Thanks, dont need to be a troll :)
>>>
>>>
>>> 2011/3/16 Shawn Milochik 
>>>
 On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
 > Yep, but i need an example and I have not found any.
 >

 If you haven't found any then you haven't looked. Have you heard of
 Google?

 Here are the docs:

 http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware

 For a full working example of middleware that modifies the request, do
 a Google search for "django middleware" and click the link for
 "Chapter 16: Middleware" of "The Django Book."

 Shawn

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


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

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



Re: How i can get username into the error mail?

2011-03-16 Thread emonk
I'm tired of searching and found many examples of middleware but not the one
I seek

2011/3/16 Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk>

> Actually, I've gotta side with Shawn on this one.
>
> There are *TONS* of examples of how to do this, I know this because I
> created one and put it on djangosnippets. :S
>
> If two people are telling you there are answers on Google, then trust me,
> there are.
>
> If you can't find them, then perhaps this isn't the job for you?
>
> On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:
>
>> I repeat, i dont have found (in all entire internet) midlleware classes
>> about email error.
>> Thanks, dont need to be a troll :)
>>
>>
>> 2011/3/16 Shawn Milochik 
>>
>>> On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
>>> > Yep, but i need an example and I have not found any.
>>> >
>>>
>>> If you haven't found any then you haven't looked. Have you heard of
>>> Google?
>>>
>>> Here are the docs:
>>>
>>> http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware
>>>
>>> For a full working example of middleware that modifies the request, do
>>> a Google search for "django middleware" and click the link for
>>> "Chapter 16: Middleware" of "The Django Book."
>>>
>>> Shawn
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread Cal Leeming [Simplicity Media Ltd]
Actually, I've gotta side with Shawn on this one.

There are *TONS* of examples of how to do this, I know this because I
created one and put it on djangosnippets. :S

If two people are telling you there are answers on Google, then trust me,
there are.

If you can't find them, then perhaps this isn't the job for you?

On Wed, Mar 16, 2011 at 6:42 PM, emonk  wrote:

> I repeat, i dont have found (in all entire internet) midlleware classes
> about email error.
> Thanks, dont need to be a troll :)
>
>
> 2011/3/16 Shawn Milochik 
>
>> On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
>> > Yep, but i need an example and I have not found any.
>> >
>>
>> If you haven't found any then you haven't looked. Have you heard of
>> Google?
>>
>> Here are the docs:
>>
>> http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware
>>
>> For a full working example of middleware that modifies the request, do
>> a Google search for "django middleware" and click the link for
>> "Chapter 16: Middleware" of "The Django Book."
>>
>> Shawn
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread emonk
I repeat, i dont have found (in all entire internet) midlleware classes
about email error.
Thanks, dont need to be a troll :)

2011/3/16 Shawn Milochik 

> On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
> > Yep, but i need an example and I have not found any.
> >
>
> If you haven't found any then you haven't looked. Have you heard of Google?
>
> Here are the docs:
>
> http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware
>
> For a full working example of middleware that modifies the request, do
> a Google search for "django middleware" and click the link for
> "Chapter 16: Middleware" of "The Django Book."
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread Shawn Milochik
On Wed, Mar 16, 2011 at 1:16 PM, emonk  wrote:
> Yep, but i need an example and I have not found any.
>

If you haven't found any then you haven't looked. Have you heard of Google?

Here are the docs:
http://docs.djangoproject.com/en/1.2/topics/http/middleware/#writing-your-own-middleware

For a full working example of middleware that modifies the request, do
a Google search for "django middleware" and click the link for
"Chapter 16: Middleware" of "The Django Book."

Shawn

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



Re: How i can get username into the error mail?

2011-03-16 Thread emonk
Yep, but i need an example and I have not found any.

2011/3/16 Tom Evans 

> On Tue, Mar 15, 2011 at 6:32 PM, emonk  wrote:
> > Hi django-users.
> >
> > I have a django project running in apache2 with  mod_wsgi and I need get
> the
> > username logged into the mail error; the user is registered in the same
> data
> > base of the project, i mean in the auth_user table (request.user.username
> > called in the views).
> >
> > This is an example of the error mail generated by a some user request
> with
> > an error and received by me (the admin) using DEBUG = False in
> settings.py:
> >
>
> Write some middleware which runs after AuthenticationMiddleware and
> inserts the user's name into request.META.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How i can get username into the error mail?

2011-03-16 Thread Tom Evans
On Tue, Mar 15, 2011 at 6:32 PM, emonk  wrote:
> Hi django-users.
>
> I have a django project running in apache2 with  mod_wsgi and I need get the
> username logged into the mail error; the user is registered in the same data
> base of the project, i mean in the auth_user table (request.user.username
> called in the views).
>
> This is an example of the error mail generated by a some user request with
> an error and received by me (the admin) using DEBUG = False in settings.py:
>

Write some middleware which runs after AuthenticationMiddleware and
inserts the user's name into request.META.

Cheers

Tom

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



How i can get username into the error mail?

2011-03-15 Thread emonk
Hi django-users.

I have a django project running in apache2 with  mod_wsgi and I need get the
username logged into the mail error; the user is registered in the same data
base of the project, i mean in the auth_user table (request.user.username
called in the views).

This is an example of the error mail generated by a some user request with
an error and received by me (the admin) using DEBUG = False in settings.py:

,
POST:,
COOKIES:{'csrftoken': '8b8344b68c0983c708c7ac0269f9fb41',
 'sessionid': '8636774d354a46c35fd8c95d741cb9fa'},
META:{'CSRF_COOKIE': '8b8344b68c0983c708c7ac0269f9fb41',
 'CSRF_COOKIE_USED': True,
 'DOCUMENT_ROOT': '*/var/www/*',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate',
 'HTTP_ACCEPT_LANGUAGE': 'es-cl,es;q=0.8,en-us;q=0.5,en;q=0.3',
 'HTTP_CACHE_CONTROL': 'max-age=0',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'sessionid=8636774d354a46c35fd8c95d741cb9fa;
csrftoken=8b8344b68c0983c708c7ac0269f9fb41',
 'HTTP_HOST': 'example.com',
 'HTTP_KEEP_ALIVE': '115',
 'HTTP_REFERER': 'http://example.com',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; es-CL;
rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15',
 'PATH': '/usr/local/bin:/usr/bin:/bin',
 'PATH_INFO': u'*/app/*',
 'PATH_TRANSLATED': '*/path/to/project/apache/script.wsgi/app/*',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '192.168.x.x',
 'REMOTE_PORT': '34717',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '*/app/*',
 'SCRIPT_FILENAME': '*/path/to/project/apache/script.wsgi*',
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': '192.168.x.x',
 'SERVER_ADMIN': 'webmas...@example.com',
 'SERVER_NAME': 'example.com',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': 'Apache/2.2.9 (Debian)
PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
mod_wsgi/2.5 Server at example.com Port 80\n',
 'SERVER_SOFTWARE': 'Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with
Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_wsgi/2.5',
 'mod_wsgi.application_group': 'example.com|',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.listener_host': '',
 'mod_wsgi.listener_port': '80',
 'mod_wsgi.process_group': 'example.com',
 'mod_wsgi.reload_mechanism': '1',
 'mod_wsgi.script_reloading': '1',
 'mod_wsgi.version': (2, 5),
 'wsgi.errors': ,
 'wsgi.file_wrapper': ,
 'wsgi.input': ,
 'wsgi.multiprocess': True,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>


Any help is welcome.
Best regards!



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