changeset 212:292226770180

bugfixes
author sergey
date Fri, 29 Jun 2012 19:24:15 +0400
parents 2b9b55cfb79b
children d6e2ea24af08
files Lib/IMPL/Transform.pm Lib/IMPL/Web/Application/RestResource.pm Lib/IMPL/Web/AutoLocator.pm Lib/IMPL/Web/Handler/RestController.pm Lib/IMPL/Web/RestContract.pm Lib/IMPL/Web/View/TTControl.pm Lib/IMPL/Web/View/TTDocument.pm
diffstat 7 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/Transform.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Transform.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -54,7 +54,7 @@
             no strict 'refs';
     	
             my @isa = @{"${class}::ISA"};
-            
+           
             while (@isa) {
             	my $sclass = shift @isa;
             	
--- a/Lib/IMPL/Web/Application/RestResource.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Web/Application/RestResource.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -32,13 +32,15 @@
 }
 
 sub CTOR {
-	my ($this) = @_;
+	my ($this,%args) = @_;
 	
 	die ArgumentException->new("target") unless $this->target;
 	
 	$this->final($this->childRegex ? 0 : 1);
 	$this->methods({}) unless $this->methods;
 	
+	$this->index($this->get) unless defined $this->index;
+	
 	if ($this->enableForms) {
         $this->methods->{create} = {
         	get => $this->get,
--- a/Lib/IMPL/Web/AutoLocator.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Web/AutoLocator.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -43,7 +43,7 @@
 		$args{query} = ref $query eq 'HASH' ? hashMerge($this->query,$query) : $query;
 	}
 	
-	return __PACKAGE__->new(%args);
+	return $this->new(%args);
 }
 
 sub SetView {
@@ -93,11 +93,11 @@
 	Locator => 'IMPL::Web::Locator'
 };
 
-my $bugTracker = Locator->new("http://myhost.org/bugzilla")->view("cgi");
+my $bugTracker = Locator->new(base => "http://myhost.org/bugzilla")->SetView("cgi");
 
 my $bug = $bugTracker->show_bug({id = 1});
 
-my $wikiPages = Locator->new("http://myhost.org/wiki/bin/view");
+my $wikiPages = Locator->new(base => "http://myhost.org/wiki/bin/view");
 
 my $page = $wiki->Main->HowTo;
 
@@ -122,3 +122,6 @@
 =head2 C<AUTLOAD>
 
 Перенаправляет вызовы методов в метод C<Fetch> передавая первым параметром имя метода.
+
+=cut
+
--- a/Lib/IMPL/Web/Handler/RestController.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Web/Handler/RestController.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -61,7 +61,7 @@
 		
 		$res = $res->FetchChildResource($id,$action);
 		
-		die NotFoundException->new() unless $res;
+		die NotFoundException->new($pathInfo,$id) unless $res;
 	}
 	
 	$res = $res->InvokeHttpMethod($method,$action);
--- a/Lib/IMPL/Web/RestContract.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Web/RestContract.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -8,6 +8,7 @@
 		InvalidOpException => '-IMPL::InvalidOperationException',
 		ForbiddenException => 'IMPL::Web::ForbiddenException',
 		TRestResource => 'IMPL::Web::Application::RestResource',
+		RestBaseResource => 'IMPL::Web::Application::RestBaseResource',
 	},
 	base => {
 		'IMPL::Transform' => sub { my %args = @_; $args{resources} },
@@ -20,7 +21,7 @@
 	
 	$this->templates->{-plain} = sub { die ForbiddenException->new(); };
 	$this->templates->{-default} = sub { die ForbiddenException->new(); };
-	$this->templates->{TRestResource} = sub { $_[0] };
+	$this->templates->{&RestBaseResource} = sub { $_[1] };
 }
 
 sub ProcessTemplate {
@@ -38,8 +39,6 @@
 	}
 }
 
-
-
 1;
 
 __END__
@@ -52,6 +51,8 @@
 
 =head1 SYNOPSIS
 
+
+
 =begin code
 
 =end code 
--- a/Lib/IMPL/Web/View/TTControl.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Web/View/TTControl.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -57,7 +57,7 @@
     $args ||= {};
     
     if ( my $ctor = $this->template->blocks->{CTOR} ) {
-        $this->context->include($ctor, { %$args, this => $this } );
+        $this->context->include($ctor, { %$args, this => $this, template => $this->template } );
     }
 }
 
@@ -85,7 +85,7 @@
     return if $method eq 'DESTROY';
     
     my $this = shift;
-    
+
     $this->nodeProperty($method,@_);
 }
 
--- a/Lib/IMPL/Web/View/TTDocument.pm	Tue Jun 05 07:45:21 2012 +0400
+++ b/Lib/IMPL/Web/View/TTDocument.pm	Fri Jun 29 19:24:15 2012 +0400
@@ -119,6 +119,7 @@
         $output = $this->context->include(
             $this->loader->layout($this->layout),
             {
+            	%{$args || {}},
                 content => sub { $output ||= $this->RenderContent($args); },
                 this => $this,
                 template => $this->template