error_handler

11 views
Skip to first unread message

alexbod...@gmail.com

unread,
Aug 18, 2009, 1:35:09 PM8/18/09
to turbo...@googlegroups.com
hello friends,

how could a controller method know whether it's invoked as an error_handler or directly?

thanks in advance,
--
alex

Diez B. Roggisch

unread,
Aug 18, 2009, 5:04:28 PM8/18/09
to turbo...@googlegroups.com
alexbod...@gmail.com schrieb:

> hello friends,
>
> how could a controller method know whether it's invoked as an
> error_handler or directly?

Through

pylons.c.validation_exception


more widely known as "template context".

This holds the formencode.Invald-exception thrown - or "".

Diez

alexbod...@gmail.com

unread,
Aug 19, 2009, 2:29:46 AM8/19/09
to turbo...@googlegroups.com

hello diez,

thanks a lot :) .
you make me closer to tg2.

On Wed, Aug 19, 2009 at 00:04, Diez B. Roggisch<de...@web.de> wrote:
>
> alexbod...@gmail.com schrieb:
>> hello friends,
>>
>> how could a controller method know whether it's invoked as an
>> error_handler or directly?
>
> Through
>
>   pylons.c.validation_exception

now i managed to do the validation: i have the error_handler invoked, and taking data from pylons.c.validation_exception.

but however, the errors don't show with error_for, as they do with other forms. i found the same problem with a form containing repeater. could i do the connection somehow?

>
>
> more widely known as "template context".
>
> This holds the formencode.Invald-exception thrown - or "".
>
> Diez
>

Diez B. Roggisch

unread,
Aug 19, 2009, 4:48:38 AM8/19/09
to turbo...@googlegroups.com
On Wednesday 19 August 2009 08:29:46 alexbod...@gmail.com wrote:
> hello diez,
>
> thanks a lot :) .
> you make me closer to tg2.
>
> On Wed, Aug 19, 2009 at 00:04, Diez B. Roggisch<de...@web.de> wrote:
> > alexbod...@gmail.com schrieb:
> >> hello friends,
> >>
> >> how could a controller method know whether it's invoked as an
> >> error_handler or directly?
> >
> > Through
> >
> >   pylons.c.validation_exception
>
> now i managed to do the validation: i have the error_handler invoked, and
> taking data from pylons.c.validation_exception.
>
> but however, the errors don't show with error_for, as they do with other
> forms. i found the same problem with a form containing repeater. could i do
> the connection somehow?

I'm not entirely sure what you mean here. However, in templates
under "c.form_errors" there should be a mapping of errors, you can work with
that of course.

But it *should* work with tw out of the box of course.

Diez

alexbod...@gmail.com

unread,
Aug 19, 2009, 4:59:39 AM8/19/09
to turbo...@googlegroups.com
hi diez,

i found it. your help and explanation put me in the position to tye the ends:

i'm passing pylons.c.validation_exception as the error parameter to the form.
i'll also take the rejected values from request, as you taught me too.

tw doesn't help, probably, because of my dynamic form.

btw: i see you on the elixir group too. have you tried my elixir patch to tg.devtool?

thanks a lot,
alex
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "TurboGears" group.
> To post to this group, send email to turbo...@googlegroups.com
> To unsubscribe from this group, send email to turbogears+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>



--
alex

Diez B. Roggisch

unread,
Aug 19, 2009, 5:25:40 AM8/19/09
to turbo...@googlegroups.com
On Wednesday 19 August 2009 10:59:39 alexbod...@gmail.com wrote:
> hi diez,
>
> i found it. your help and explanation put me in the position to tye the
> ends:
>
> i'm passing pylons.c.validation_exception as the error parameter to the
> form. i'll also take the rejected values from request, as you taught me
> too.
>
> tw doesn't help, probably, because of my dynamic form.

Ok.

> btw: i see you on the elixir group too. have you tried my elixir patch to
> tg.devtool?

No, I don't quickstart projects regularly, and our own project has a very
different structure anyway - but uses Elixir.

Diez

alexbod...@gmail.com

unread,
Aug 19, 2009, 8:00:19 PM8/19/09
to turbo...@googlegroups.com
well, not yet.

On Wed, Aug 19, 2009 at 12:25, Diez B. Roggisch<de...@web.de> wrote:
>
> On Wednesday 19 August 2009 10:59:39 alexbod...@gmail.com wrote:
>> hi diez,
>>
>> i found it. your help and explanation put me in the position to tye the
>> ends:
>>
>> i'm passing pylons.c.validation_exception as the error parameter to the
>> form. i'll also take the rejected values from request, as you taught me
>> too.
>>

the value i send is being ignored because the error param is not empty.
let me see ;) .


>> tw doesn't help, probably, because of my dynamic form.
>
> Ok.
>
>> btw: i see you on the elixir group too. have you tried my elixir patch to
>> tg.devtool?
>
> No, I don't quickstart projects regularly, and our own project has a very
> different structure anyway - but uses Elixir.
>
> Diez
>

alexbod...@gmail.com

unread,
Aug 19, 2009, 10:12:12 PM8/19/09
to turbo...@googlegroups.com
found it.

On Thu, Aug 20, 2009 at 03:00, <alexbod...@gmail.com> wrote:
> well, not yet.
>
> On Wed, Aug 19, 2009 at 12:25, Diez B. Roggisch<de...@web.de> wrote:
>>
>> On Wednesday 19 August 2009 10:59:39 alexbod...@gmail.com wrote:
>>>
>>> hi diez,
>>>
>>> i found it. your help and explanation put me in the position to tye the
>>> ends:
>>>
>>> i'm passing pylons.c.validation_exception as the error parameter to the
>>> form. i'll also take the rejected values from request, as you taught me
>>> too.
>>>
> the value i send is being ignored because the error param is not empty.
> let me see ;) .

it's value_at_request :)


>>>
>>> tw doesn't help, probably, because of my dynamic form.
>>
>> Ok.
>>
>>> btw: i see you on the elixir group too. have you tried my elixir patch to
>>> tg.devtool?
>>
>> No, I don't quickstart projects regularly, and our own project has a very
>> different structure anyway - but uses Elixir.
>>
>> Diez
>>
>> --~--~---------~--~----~------------~-------~--~----~
>> You received this message because you are subscribed to the Google Groups
>> "TurboGears" group.
>> To post to this group, send email to turbo...@googlegroups.com
>> To unsubscribe from this group, send email to
>> turbogears+...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/turbogears?hl=en
>> -~----------~----~----~----~------~----~------~--~---
>>
>>
>
>
>
> --
> alex
>
>

--
alex

Reply all
Reply to author
Forward
0 new messages