[Rt-commit] r20079 - rt/3.8/trunk/lib/RT/Interface/Web
ruz at bestpractical.com
ruz at bestpractical.com
Wed Jul 1 18:39:46 EDT 2009
Author: ruz
Date: Wed Jul 1 18:39:46 2009
New Revision: 20079
Modified:
rt/3.8/trunk/lib/RT/Interface/Web/Request.pm
Log:
* add request_path to the RT's mason request sub-class
Modified: rt/3.8/trunk/lib/RT/Interface/Web/Request.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Interface/Web/Request.pm (original)
+++ rt/3.8/trunk/lib/RT/Interface/Web/Request.pm Wed Jul 1 18:39:46 2009
@@ -183,4 +183,25 @@
}
}
+=head2 request_path
+
+Returns path of the request.
+
+Very close to C<< $m->request_comp->path >>, but if called in a dhandler returns
+path of the request without dhandler name, but with dhandler arguments instead.
+
+=cut
+
+sub request_path {
+ my $self = shift;
+
+ my $path = $self->request_comp->path;
+ # disabled dhandlers, not RT case, but anyway
+ return $path unless my $dh_name = $self->dhandler_name;
+ # not a dhandler
+ return $path unless substr($path, -length("/$dh_name")) eq "/$dh_name";
+ substr($path, -length $dh_name) = $self->dhandler_arg;
+ return $path;
+}
+
1;
More information about the Rt-commit
mailing list