Re: [Maypole] CGI::Maypole trailing slashes issue

From: Sebastian Riedel (sri at oook.de)
Date: Sat Sep 11 2004 - 16:19:28 BST


Simon Flack schrieb:

>This patch adds a trailing slash where necessary, rather than adding it on
>after stripping it off.
>
>Index: trunk/lib/Maypole/View/Base.pm
>===================================================================
>--- trunk/lib/Maypole/View/Base.pm (revision 172)
>+++ trunk/lib/Maypole/View/Base.pm (working copy)
>@@ -22,7 +22,7 @@
> my ($self, $r) = @_;
> my $class = $r->model_class;
> my $base = $r->{config}->{uri_base};
>- $base =~ s/\/+$//;
>+ $base =~ s/([^\/])$/$1\//;
> my %args = (
> request => $r,
> objects => $r->objects,
>
>
>On Sat, 11 Sep 2004 15:47:01 +0300 (IDT), Gabor Szabo wrote
>
>
>>When I was trying to setup CGI::Maypole I encountered a few issues,
>>let me send them to the list so that either someone can explain me
>>how to do it better or if this is the best solution then it might
>>help oters to find the solution for their similar problemts.
>>
>>In my module I write:
>>
>>use base 'CGI::Maypole';
>>BEGIN {
>> Module::CPANTS::Maypole-
>>
>>
>>>setup("dbi:SQLite:dbname=../../db/cpants.db"); }
>>>
>>>
>>Module::CPANTS::Maypole->config->{uri_base} = "http://$ENV{HTTP_HOST}/";
>>
>>[... rest skipped]
>>This should be enough for the trailing slashes but then once I click
>>on one of the table views all the new links were missing the slash between
>>the hostname and the rest of the URL.
>>I patched Maypole::View::Base and it works now.
>>Here is the patch:
>>
>>--- /opt/perl584/lib/site_perl/5.8.4/Maypole/View/Base.pm Sat Jul 17
>>19:55:03 2004
>>+++ www/cgi/Maypole/View/Base.pm Mon Sep 6 09:39:54 2004
>>@@ -23,6 +23,7 @@
>> my $class = $r->model_class;
>> my $base = $r->{config}->{uri_base};
>> $base =~ s/\/+$//;
>>+ $base .= "/";
>> my %args = (
>> request => $r,
>> objects => $r->objects,
>>
>>Do I really need this patch or did I make a mistake somewhere else ?
>>
>>BTW if this is relevant, this is the Apache configuration I use:
>>
>><VirtualHost 127.0.0.1>
>> ServerName cpants.local
>> DocumentRoot /web/cpants/www
>> Alias /robots.txt /web/cpants/www/robots.txt
>> Alias /cpants.css /web/cpants/www/cpants.css
>> Alias /favicon.ico /web/cpants/www/favicon.ico
>> ScriptAliasMatch ^/(.*)$ /web/cpants/www/cgi/cpants.pl/$1
>></VirtualHost>
>>
>>Gabor
>>
>>_______________________________________________
>>maypole mailing list
>>maypole at lists.netthink.co.uk
>>http://lists.netthink.co.uk/listinfo/maypole
>>
>>
>
>
>
And again, this is already fixed in the svn version...but by modifying
the template macro.

>--simonflk
>
>
>_______________________________________________
>maypole mailing list
>maypole at lists.netthink.co.uk
>http://lists.netthink.co.uk/listinfo/maypole
>
>
>
sebastian

_______________________________________________
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:56 GMT