[Jifty-commit] r1574 - in jifty/trunk: lib/Jifty t/TestApp/t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Jul 14 19:12:17 EDT 2006


Author: jesse
Date: Fri Jul 14 19:12:17 2006
New Revision: 1574

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web.pm
   jifty/trunk/t/TestApp/t/08-notifications.t

Log:
 r13964 at pinglin:  jesse | 2006-07-14 19:12:07 -0400
 * Switched Jifty::Web::url to use uri.pm rather than "heuristics"


Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Fri Jul 14 19:12:17 2006
@@ -111,28 +111,22 @@
 
 sub url {
     my $self = shift;
-    my %args = @_;
+    my %args = (scheme => undef,
+                @_);
 
     my $url  = Jifty->config->framework("Web")->{BaseURL};
     my $port = Jifty->config->framework("Web")->{Port};
-    
-    my $scheme = 'http';
-    if ($url =~ /^(\w+)/) {
-        $scheme = $1;
+   
+    if ($args{'scheme'}) {
+        $self->log->error("Jifty->web->url no longer accepts a 'scheme' argument");
     }
-    $scheme = $args{scheme} if $args{scheme};
-
+    my $uri = URI->new($url);
+    
     if ($ENV{'HTTP_HOST'}) {
-        return $scheme ."://".$ENV{'HTTP_HOST'};
-    }
-
-    my $append_port = 0;
-    if (   ( $scheme  eq 'http' and $port != 80 )
-        or ( $scheme  eq'https' and $port != 443 ) ) {
-        $append_port = 1;
+        return $uri->scheme ."://".$ENV{'HTTP_HOST'};
     }
-    return( $url . ($append_port ? ":$port" : ""));
 
+    return $uri->canonical;
 }
 
 =head3 serial 

Modified: jifty/trunk/t/TestApp/t/08-notifications.t
==============================================================================
--- jifty/trunk/t/TestApp/t/08-notifications.t	(original)
+++ jifty/trunk/t/TestApp/t/08-notifications.t	Fri Jul 14 19:12:17 2006
@@ -8,6 +8,6 @@
 use Jifty::Test tests => 2;
 use_ok('Jifty::Notification');
 
-TODO {local $TODO = "Actually write tests"; ok(0, "Test notifications")};
+TODO: {local $TODO = "Actually write tests"; ok(0, "Test notifications")};
 
 1;


More information about the Jifty-commit mailing list