*** /e/www/twiki-dakar-4.0.2/lib/TWiki/Form.pm.v2	Wed Sep 20 20:27:14 2006
--- /e/www/twiki-dakar-4.0.2/lib/TWiki/Form.pm	Wed Sep 20 20:29:17 2006
***************
*** 72,78 ****
  =cut
  
  sub new {
!     my( $class, $session, $web, $form, $noNameCheck ) = @_;
      my $this = bless( {}, $class );
  
      ( $web, $form ) =
--- 72,78 ----
  =cut
  
  sub new {
!     my( $class, $session, $web, $form, $def ) = @_;
      my $this = bless( {}, $class );
  
      ( $web, $form ) =
***************
*** 80,96 ****
  
      my $store = $session->{store};
  
-     # Read topic that defines the form
-     unless( $store->topicExists( $web, $form ) ) {
-         return undef;
-     }
-     my( $meta, $text ) =
-       $store->readTopic( $session->{user}, $web, $form, undef );
- 
      $this->{session} = $session;
      $this->{web} = $web;
      $this->{topic} = $form;
!     $this->{fields} = $this->_parseFormDefinition( $text );
  
      # Expand out values arrays in the definition
      # SMELL: this should be done lazily
--- 80,103 ----
  
      my $store = $session->{store};
  
      $this->{session} = $session;
      $this->{web} = $web;
      $this->{topic} = $form;
! 
!     unless ( $def ) {
! 
!       # Read topic that defines the form
!       unless( $store->topicExists( $web, $form ) ) {
!         return undef;
!       }
!       my( $meta, $text ) =
! 	$store->readTopic( $session->{user}, $web, $form, undef );
! 
!       $this->{fields} = $this->_parseFormDefinition( $text );
! 
!     } else {
!       $this->{fields} = $def;
!     }
  
      # Expand out values arrays in the definition
      # SMELL: this should be done lazily

