Orkut Gmail Calendar Documents Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
using the quickstart authentication
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
adam  
View profile  
 More options Nov 20 2009, 5:24 pm
From: adam <a...@adamplowman.co.uk>
Date: Fri, 20 Nov 2009 03:54:04 -0800 (PST)
Local: Fri, Nov 20 2009 5:24 pm
Subject: using the quickstart authentication
Hello,

Within my app i allow a user to change their details. When i try and
do this

try:
                username = request.identity['repoze.who.userid']
                users = DBSession.query(User).filter_by
(user_name=session.get('old_username', None)).one()
                users.user_name = str(cgi.escape(kw['username']))
                users.display_name = str(cgi.escape(kw['display']))
                users.email_address = str(cgi.escape(kw['email']))
                flash(_('User updated'), 'info')
except:
                flash(_('User not added'), 'error')
                redirect('/settings/edit_user

everything works fine if i am updating the display name but when i
update the username or the email address nothing happen. The except
section doesnt kick in. The page is just redirected to /settings

What have i misses. I am using the quick start authentication method.

Thanks for any help

Adam


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Nov 20 2009, 6:03 pm
From: Christoph Zwerschke <c...@online.de>
Date: Fri, 20 Nov 2009 13:33:51 +0100
Local: Fri, Nov 20 2009 6:03 pm
Subject: Re: [TurboGears] using the quickstart authentication
adam schrieb:

> What have i misses. I am using the quick start authentication method.

You're missing a DBSession.flush().

-- Christoph


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
adam  
View profile  
 More options Nov 20 2009, 6:07 pm
From: adam <a...@adamplowman.co.uk>
Date: Fri, 20 Nov 2009 04:37:03 -0800 (PST)
Local: Fri, Nov 20 2009 6:07 pm
Subject: Re: using the quickstart authentication
That still won't update the fields at all. Just the redirect.

On Nov 20, 12:33 pm, Christoph Zwerschke <c...@online.de> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Nov 20 2009, 6:35 pm
From: Christoph Zwerschke <c...@online.de>
Date: Fri, 20 Nov 2009 14:05:29 +0100
Local: Fri, Nov 20 2009 6:35 pm
Subject: Re: [TurboGears] Re: using the quickstart authentication
adam schrieb:

> That still won't update the fields at all. Just the redirect.

You wrote that the exception does not take place, but in the code you
pasted, the redirect happens in the except clause?

Btw, instead of str(cgi.escape(...)) you should use the TurboGears
validate decorator on your parameters.

-- Christoph


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
adam  
View profile  
 More options Nov 20 2009, 7:05 pm
From: adam <a...@adamplowman.co.uk>
Date: Fri, 20 Nov 2009 05:35:23 -0800 (PST)
Local: Fri, Nov 20 2009 7:05 pm
Subject: Re: using the quickstart authentication
The redirect in the except is no happening its one else where that is
used if the update has occured.

What do you mean by TurboGears validate decorator on your parameters,
i am new to tg2 and have yet to explore everything.

On Nov 20, 1:05 pm, Christoph Zwerschke <c...@online.de> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Nov 20 2009, 7:47 pm
From: Christoph Zwerschke <c...@online.de>
Date: Fri, 20 Nov 2009 15:17:34 +0100
Local: Fri, Nov 20 2009 7:47 pm
Subject: Re: [TurboGears] Re: using the quickstart authentication
adam schrieb:

> The redirect in the except is no happening its one else where that is
> used if the update has occured.

So you're seeing the flash message "User updated" and you have added the
DBSession.flush()? It should work then. Check if you're really picking
the right juser object with old_username. You can always add print, log
and assert statements, or add them to the flash message, to make such
things sure, or even use a debugger. If you still have problems, you
will need to paste your complete example.

http://turbogears.org/2.1/docs/main/Validation.html

> What do you mean by TurboGears validate decorator on your parameters,
> i am new to tg2 and have yet to explore everything.

http://turbogears.org/2.1/docs/main/Validation.html

-- Christoph


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
adam  
View profile  
 More options Nov 23 2009, 6:05 pm
From: adam <a...@adamplowman.co.uk>
Date: Mon, 23 Nov 2009 04:35:54 -0800 (PST)
Local: Mon, Nov 23 2009 6:05 pm
Subject: Re: using the quickstart authentication
ok i am trying to add in the validation but i am a little confused as
i am not using form widgets. So i am trying something like

 @validate(validators={"kw['group']":validators.Int()})
    def groupsession(self,**kw):
            group_id =kw['group']
            print "wanker"
            print group_id

but i am getting the error  NameError: name 'validate' is not defined
and i am importing like from formencode import validators. So i can
tell if i am doing this right. Any help?

On Nov 20, 2:17 pm, Christoph Zwerschke <c...@online.de> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile  
 More options Nov 23 2009, 6:13 pm
From: "Diez B. Roggisch" <de...@web.de>
Date: Mon, 23 Nov 2009 13:43:40 +0100
Local: Mon, Nov 23 2009 6:13 pm
Subject: Re: [TurboGears] Re: using the quickstart authentication
On Monday 23 November 2009 13:35:54 adam wrote:

> ok i am trying to add in the validation but i am a little confused as
> i am not using form widgets. So i am trying something like

>  @validate(validators={"kw['group']":validators.Int()})
>     def groupsession(self,**kw):
>             group_id =kw['group']
>             print "wanker"
>             print group_id

> but i am getting the error  NameError: name 'validate' is not defined
> and i am importing like from formencode import validators. So i can
> tell if i am doing this right. Any help?

from tg import validate

Should be in a quickstarted project.

Diez


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Nov 23 2009, 6:55 pm
From: Christoph Zwerschke <c...@online.de>
Date: Mon, 23 Nov 2009 14:25:32 +0100
Local: Mon, Nov 23 2009 6:55 pm
Subject: Re: [TurboGears] Re: using the quickstart authentication

Also, you're using kw in the decorator where it's not defined. Just put
'group' there. You can also use a Form/Schema.

-- Christoph


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google