[html-formfu] Re: Multiple inheritence with FormFu Catalyst Controllers

Moritz Onken onken at houseofdesign.de
Sun Apr 5 20:56:33 GMT 2009


On a second thought, I'm not quite sure if it works.

The end method looks like this:

sub end : ActionClass('Serialize') {
     my ( $self, $c ) = @_;
     $self->next::method($c);
     if ( $self->is_extjs_upload($c) ) {	
		# SNIP
     }
}

I didn't write a test or anything but I think that $self- 
 >next::method($c); sets the body already.
So my upload specific code will never be run if we add " and not  
length( $c->response->body )".

moritz


Am 05.04.2009 um 21:57 schrieb Mario Minati:

> Hello Moritz,
>
> the end method has a problem.
> If it is a file upload it overwrites the output no matter what.  
> Usually
> Serialize only writes output/body if it has no length.
>
> Would you mind if we use the following in line 55:
>
>    if ( $self->is_extjs_upload($c) and not length( $c->response- 
> >body )) {
>
> I need this for my custom extension which needs a TT renderer in a  
> inherited
> class of CatalystX::Controller::ExtJS::REST.
>
>
> Greets,
>
> Mario Minati
>
> ----------  Weitergeleitete Nachricht  ----------
>
> Betreff: Re: [html-formfu] Re: Multiple inheritence with FormFu  
> Catalyst
> Controllers
> Datum: Samstag 04 April 2009
> Von: Mario Minati <mario.minati at googlemail.com>
> An: "HTML Form Creation, Rendering and Validation Framework"
> <html-formfu at lists.scsys.co.uk>
>
> Hi Moritz,
>
> I was also on the go since thursday, so not much time yet.
>
> Am Mittwoch 01 April 2009 07:43:08 schrieb Moritz Onken:
>> Am 01.04.2009 um 00:50 schrieb Mario Minati:
>>> Hi Moritz,
>>>
>>> I like your Controller very much.
>>>
>>> Just some questions:
>>>
>>> Do you know if it can handle uploads with the Ext ux SwfUpload?
>>> Probably no as the code of handle_uploads suggests.
>>
>> I have no Idea how SwfUpload works. AFAIK it allows to upload
>> multiple files. Does it submit the form data as well? If not,
>> this uploading thing should be an extra controller.
>>
>> As I did with ImageChooser I would suggest
>> CatalystX::Controller::ExtJS::SwfUpload
>
> Forget about SwfUpload, I found out that it has unsolved problems  
> with firefox
> on linux, so not a way I will follow any longer. There are other  
> Upload
> controllers, which can upload files via a POST request, but not  
> integrated
> with a more complex form.
>
> I'll look at this later on, may be extending one of those solutions.
>
>>> Line 134 is:
>>>      $object = $object->$self->config->{default_rs_method};
>>> Is that correct? It looks a bit to perlish, but I'm not sure.
>>
>> Yes, that line is totally wrong, shold look like:
>>
>>        my $rs = $self->config->{default_rs_method}
>>        $object = $object->$rs;
>>
>>> How do you handle the usual controller logic, do you put it into the
>>> model and
>>> let the update die on problems or do you overwrite the PUT/PUSH
>>> methods?
>>
>> What kind of logic are we talking about? I put A LOT of logic in the
>> model.
>> This helps me with testing and I have currently a daemon process who
>> needs
>> to access the model. So I have everything there. Most of the logic is
>> handled by formfu.
>
> Model, ok.
>
>>> Do you plan to put that module into the formfu repository?
>>
>> Yes I do. Just wanted to write some more documentation and ask Carl  
>> if
>> I can
>> upload it there. I'm off until sunday and don't have internet access.
>> But here is the latest and greatest latest version of this  
>> controller.
>> I fixed the bug you mentioned and dropped the requirement for so many
>> files.
>> If one of the put/get/post/list files cannot be found it falls back
>> to the base file root/forms/???.yml
>>
>> You are welcome to patch and write on. Or even upload it to the  
>> formfu
>> repo. I already have my bags packed and will leave in a few minutes.
>
> As you changed the code, you better put the latest code into the  
> repo ;-)
>
>> One more thing, there are no tests yet. The module lives currently  
>> in my
>> app's lib directory. So we need a module::install environment or
>> something.
>
> I'm willing to help with tests, but am not (yet) familiar with that
> module::install environment, so this may you can take care of that.
>
>
>> See you next monday!
>
> Have a nice weekend,
>
> Mario Minati
>
>
>> Am 01.04.2009 um 00:50 schrieb Mario Minati:
>>> Hi Moritz,
>>>
>>> I like your Controller very much.
>>>
>>> Just some questions:
>>>
>>> Do you know if it can handle uploads with the Ext ux SwfUpload?
>>> Probably no as the code of handle_uploads suggests.
>>>
>>> Line 134 is:
>>>       $object = $object->$self->config->{default_rs_method};
>>> Is that correct? It looks a bit to perlish, but I'm not sure.
>>>
>>> How do you handle the usual controller logic, do you put it into the
>>> model and
>>> let the update die on problems or do you overwrite the PUT/PUSH
>>> methods?
>>>
>>> Do you plan to put that module into the formfu repository?
>>>
>>>
>>> Greets,
>>>
>>> Mario Minati
>>>
>>> Am Dienstag 31 März 2009 13:13:09 schrieb Moritz Onken:
>>>> Hi Mario,
>>>>
>>>> I wrote a Catalyst controller which might be worth looking at for
>>>> you.
>>>>
>>>> It handles all kind of REST requests using formfu config files. For
>>>> each kind of request there is an extra file.
>>>>
>>>> I added a few bits of documentation to it. It's currently in
>>>> development for a new project I'm working on.
>>>>
>>>> My Controllers look currently something like this:
>>>>
>>>> package MyApp::Controller::User;
>>>> use strict;
>>>> use warnings;
>>>>
>>>> use base 'CatalystX::Controller::ExtJS::REST';
>>>>
>>>>
>>>> 1;
>>>>
>>>>
>>>> This will create two chained actions: /user and /users, where you  
>>>> can
>>>> post,put, delete and get whatever you want.
>>>>
>>>> You can read the documentation I wrote and try it.
>>>
>>> _______________________________________________
>>> HTML-FormFu mailing list
>>> HTML-FormFu at lists.scsys.co.uk
>>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>>
>> _______________________________________________
>> HTML-FormFu mailing list
>> HTML-FormFu at lists.scsys.co.uk
>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
>
>
> -------------------------------------------------------
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




More information about the HTML-FormFu mailing list