diff Lib/IMPL/Web/View/TTDocument.pm @ 311:d3b5a67ad2e8

sync
author cin
date Mon, 22 Apr 2013 03:42:53 +0400
parents 0a9d51cf6dfd
children ec4ec1f056fe
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTDocument.pm	Fri Apr 19 16:39:01 2013 +0400
+++ b/Lib/IMPL/Web/View/TTDocument.pm	Mon Apr 22 03:42:53 2013 +0400
@@ -24,18 +24,22 @@
     ],
     props => [
         layout => PROP_RW,
+        layoutBase => PROP_RW,
+        registry => PROP_RW,
         baseLocation => PROP_RW
     ]
 };
 
 sub CTOR {
-    my ($this,$template,$ctx,$vars) = @_;
+    my ($this,$template,$ctx) = @_;
     
     $this->layout( $template->layout ) unless $this->layout;
     $this->title( $template->title ) unless $this->title;
-    
-    $this->context->stash->update($vars)
-        if ref $vars eq 'HASH';
+    my $doc = $this;
+    weaken($doc);
+    $this->registry->context->stash->update({
+        document => sub { $doc }
+    });
 }
 
 sub Render {
@@ -44,9 +48,9 @@
     $args ||= {};
     $args->{document} = $this;
     
-    $this->context->stash->update({
-    	document => sub { $this }
-    });
+    #$this->context->stash->update({
+    #	document => sub { $this }
+    #});
     
     my $text = eval {
     
@@ -66,7 +70,7 @@
     
     my $e = $@;
     
-    undef $this;
+    # undef $this;
     
     if ($e) {
         die $e;