Re: [Maypole] Why is moniker used instead of of table name when looking for table specific templates?

From: Dave Howorth (Dave.Howorth at acm.org)
Date: Mon Dec 27 2004 - 00:13:27 GMT


Hi Peter,

Marry Christmas :)

Peter Speltz wrote:
> Why, when looking for templates associated with a class/table, does
> Maypole::View look in a dir named after class's moniker rather than
> table?

I suspect it's because a table name can include strange characters
(anything except / \ and . in MySQL) and may or may not be case
sensitive depending on the database and file system. The moniker is
derived from the class name (which only includes alphanumerics) and is
always lower case.

> Since default url processing are based on table why are'nt template
> paths?

Good question, or perhaps why isn't URL processing based on the moniker?
Has anybody tried tables with 'strange' characters?

> Also the docs aren't real specific about the fact that moniker is
> used.

Thanks for pointing out this error. I'll make sure the docs are explicit
about this point in the next release.

> I'm not sure why moniker was used instead of table name. HOwever
> moniker is overrideable so if you decide to change it, you'd need to
> change names of your template directories.

Overriding moniker is not a good idea, because it is used internally by
Class::DBI as well as Maypole.

> To fix this i changed the line in M::View::Base.pm with
> $r->model_class->moniker to $r->model_class->table.

I get worked up about Maypole plugging raw table names and monikers into
the HTML output seen by users, but personally I don't care that much
what name is used for the template directory :)

Cheers, Dave

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.4 - Release Date: 22/12/04

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT