# HG changeset patch # User sergey # Date 1340983455 -14400 # Node ID 292226770180446f0b906f7511094ff977051b54 # Parent 2b9b55cfb79b960d3a203ec6e97adcd29ef59960 bugfixes diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Transform.pm --- 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; diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Web/Application/RestResource.pm --- 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, diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Web/AutoLocator.pm --- 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 Перенаправляет вызовы методов в метод C передавая первым параметром имя метода. + +=cut + diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Web/Handler/RestController.pm --- 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); diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Web/RestContract.pm --- 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 diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Web/View/TTControl.pm --- 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,@_); } diff -r 2b9b55cfb79b -r 292226770180 Lib/IMPL/Web/View/TTDocument.pm --- 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