[jifty-devel] Customizing the Jifty Login plugin.
Wolfgang Kinkeldei
wolfgang at kinkeldei.de
Thu Nov 30 15:30:05 EST 2006
Hello,
On 28.11.2006 at 07:22 C.G. LEE wrote:
> I'm now trying to add two columns to the Login User; homepage,
> blog. I added the two columns to Model::User::Schema, and
> Model::User inherits the User model of the Login. Then, when I try
> to sign up, I got the error below,
>
> Error in /home/w3pm/perl/lib/site_perl/5.8.8/Jifty/Action/Record.pm
> line 149 Can't locate object method "homepage" via package
> "Jifty::Plugin::Login::Model::User"
> I think Jifty grabs my User(Model) but not my Signup(Action). I
> could edit the Login dispatcher, but I don't want to touch the
> Login. Please show me the recipe if you have.
I tested a bit to see what happens. If you create a class
"App::Model::User" having "Jifty::Plugin::Login::Model::User" as base
and append fields to the schema, the database is created right. fine.
After an action of class "App::Action::CreateUser" is build via Jifty-
>web->new_action, this action reports its "record_class" to be
"Jifty::Plugin::Login::Model::User" instead of your own class
"App::Model::User". I am not quite sure, but I think this is a side-
effect of Module::Pluggable, as I did never see a
"App::Action::CreateUser" to get created by "Jifty::ClassLoader".
Applying a *bad* hack into the "App::User" class like
# bad hack!!!
package App::Action::CreateUser;
sub record_class {
'App::Model::User';
}
now reports the right "record_class" on the action and the admin
works. However, the Action modules in the Login plugin explicitly use
the "Jifty::Plugin::Login::Action::..." actions, so they will not
work on expanded models.
Maybe there is a way to get around this. I personally would find the
possibility of expanding the "User" record fine...
Otherwise I should better erase the "Expanding..." section on
AccessControl.pod.
Wolfgang
--
' /\_/\ ' .print[split??,"".(($/=q|Cms)+-03467:;<=|)=~tr!C-z -B! -z!)x
'( o.o )' .$/]->[hex]foreach split qr<>,qq+1ecd039ad65b025b8063475b+||
' > ^ < ' .q<!-- Wolfgang Kinkeldei - mailto:wolfgang at kinkeldei.de -->
More information about the jifty-devel
mailing list