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

From: Peter Speltz (peterspeltz at yahoo.com)
Date: Mon Dec 27 2004 - 18:02:24 GMT


--- Dave Howorth <Dave.Howorth at acm.org> wrote:

> Hi Peter,
>
> Marry Christmas :)
>

Merry 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.

Really , really a nice try, Dave :) HOwever, in mysql table names are actually
" Any character that is allowed in a directory name, except `/', `\', or `.' "
So table name should be able to map to directory name no problem. Maybe other
databases are different though.

>The moniker is
> derived from the class name (which only includes alphanumerics) and is
> always lower case.
>

But how the heck do i know what it is? Its not documented anywhere and its
overridable. Only through experimentation did i find it lowercases the whole
thing. But what does it do to '_'? I don't know cause cdbi loader makes
classes CamelCase.

> > 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?
>

I tried in creating a mysql table with all of these "characters you shouldn't
use in unix file/directory names ( | ; , ! @ # $ ( ) < > / \ " ' ` ~ { } [ ] =
+ & ^ <space> <tab>j) and couldn't do it from the shell.

> > 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 :)
>
>

Me too. I was hoping to override moniker to fix this. I remember a thread on it
and maypole being internally dependent on it. I hope that can be fixed.

> --
> 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
>

=====
pjs

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
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