Re: [CDBI] Weirdness trying to limit Class::DBI has_many relationship from TT template

[prev] [thread] [next] [Date index for 2005/10/13]

From: Will Hawes
Subject: Re: [CDBI] Weirdness trying to limit Class::DBI has_many relationship from TT template
Date: 11:28 on 13 Oct 2005
----- Original Message -----
From: Dave Howorth <dhoworth@xxxxxxx.xxx.xx.xx>
To: Class DBI <classdbi@xxxxx.xxxxxxxxxxxxxxxx.xxx>
Sent: Thu, 13 Oct 2005 11:49:40 +0100
Subject: Re: [CDBI] Weirdness trying to limit Class::DBI has=5Fmany rela=
tionship=09from TT template

> That's the best way to write the call to that method, but it's not tru=
e=20
> to say that TT doesn't recognize =3D>. If you write:
>=20
>    [% images =3D product.images(image=5Ftype =3D> 1); %]
>=20
> TT converts it into Perl something like this:
>=20
>    $images =3D $product->images({ image=5Ftype =3D> 1 })
>=20
> Note the extra braces { }. And image=5Ftype is quoted automatically. (=
But=20
> it's not really manipulating variables called $images etc  - that's ju=
st=20
> for explanation :)

If this is the intended behaviour of TT (which I had assumed), it's not =
what I'm seeing. If I use the above syntax, the limit criteria are ignor=
ed.

>=20
> Perhaps more interesting:
>=20
>    [% obj.meth( a =3D> 1, b, c =3D> 2, d ) %]
>=20
> becomes
>=20
>    $obj->meth(b, d, { a =3D> 1, c =3D> 2 });
>=20
> If you're writing methods to be called from templates, it's best to pl=
an=20
> to allow this calling style, otherwise people get frustrated when they=
=20
> write =3D> in the template without thinking! So enhancing the images=
=20
> method might be the best thing to do.

I'm not sure how (if=3F) it needs to be modified. In this instance my im=
ages method has been created automatically by CDBI's has=5Fany mechanism=
.


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

Re: [CDBI] Weirdness trying to limit Class::DBI has_many relationship from TT template
Will Hawes 11:28 on 13 Oct 2005

Generated at 15:35 on 18 Oct 2005 by mariachi v0.52