# HG changeset patch # User cin # Date 1362433592 -14400 # Node ID 86ff93b34f2a168a9ef9dacd64bc76e3e8f37508 # Parent 9b25e1f50144bc46fcb1cd9fc1a3e44f725ec335 sync diff -r 9b25e1f50144 -r 86ff93b34f2a Lib/IMPL/Web/View/TTControl.pm --- a/Lib/IMPL/Web/View/TTControl.pm Fri Mar 01 03:15:30 2013 +0400 +++ b/Lib/IMPL/Web/View/TTControl.pm Tue Mar 05 01:46:32 2013 +0400 @@ -6,6 +6,7 @@ use Scalar::Util qw(blessed); use IMPL::declare { require => { + TemplateDocument => 'Template::Document', TTContext => 'Template::Context', Exception => 'IMPL::Exception', ArgumentException => '-IMPL::InvalidArgumentException', @@ -113,11 +114,20 @@ } sub RenderBlock { - my ($this,$block, $args) = @_; + my ($this, $block, $args) = @_; $args = {} unless ref $args eq 'HASH'; - return $this->context->include( $block, { %$args, this => $this, template => $this->template } ); + return $block ? $this->context->include( $block, { %$args, this => $this, template => $this->template } ) : undef; +} + +sub ExportBlock { + my ($this,$block) = @_; + + return TemplateDocument->new({ + BLOCK => $this->template->blocks->{$block}, + DEFBLOCKS => $this->template->blocks + }); } sub AUTOLOAD { diff -r 9b25e1f50144 -r 86ff93b34f2a Lib/IMPL/Web/View/TTFactory.pm --- a/Lib/IMPL/Web/View/TTFactory.pm Fri Mar 01 03:15:30 2013 +0400 +++ b/Lib/IMPL/Web/View/TTFactory.pm Tue Mar 05 01:46:32 2013 +0400 @@ -84,6 +84,8 @@ if (my $init = $this->template->blocks->{INIT}) { $this->context->process($init); } + + $this->context->visit($this->template->blocks); } my $instance = $this->SUPER::CreateObject(@_);