Index: twikiplugins/EditContrib/lib/TWiki/Contrib/EditContrib.pm
===================================================================
--- twikiplugins/EditContrib/lib/TWiki/Contrib/EditContrib.pm	(revision 13708)
+++ twikiplugins/EditContrib/lib/TWiki/Contrib/EditContrib.pm	(working copy)
@@ -55,6 +55,7 @@
     my $webName = $session->{webName};
     my $topic = $session->{topicName};
     my $user = $session->{user};
+    my $users = $session->{users};
 
     # empty means edit both form and text, "form" means edit form only,
     # "text" means edit text only
@@ -69,18 +70,19 @@
     my $topicExists  = $store->topicExists( $webName, $topic );
 
     # If you want to edit, you have to be able to view and change.
-    TWiki::UI::checkAccess( $session, $webName, $topic, 'view', $user );
-    TWiki::UI::checkAccess( $session, $webName, $topic, 'change', $user );
+    TWiki::UI::checkAccess( $session, $webName, $topic, 'VIEW', $user );
+    TWiki::UI::checkAccess( $session, $webName, $topic, 'CHANGE', $user );
 
     # Check lease, unless we have been instructed to ignore it
-    # or if we are using the 10X's topic name for dynamic topic names
+    # or if we are using the 10X's or AUTOINC topic name for
+    # dynamic topic names.
     my $breakLock = $query->param( 'breaklock' ) || '';
-    unless( $breakLock || ($topic =~ /X{10}/ )) {
+    unless( $breakLock || $topic =~ /X{10}/ || $topic =~ /AUTOINC\d+/) {
         my $lease = $store->getLease( $webName, $topic );
         if( $lease ) {
-            my $who = $lease->{user}->webDotWikiName();
+            my $who = $users->webDotWikiName($lease->{user});
 
-            if( $who ne $user->webDotWikiName() ) {
+            if( $who ne $users->webDotWikiName($user) ) {
                 # redirect; we are trying to break someone else's lease
                 my( $future, $past );
                 my $why = $lease->{message};
@@ -109,13 +111,14 @@
                 if( $def ) {
                     # use a 'keep' redirect to ensure we pass parameter
                     # values in the query on to the oops script
-                    throw TWiki::OopsException( 'leaseconflict',
-                                                keep => 1,
-                                                def => $def,
-                                                web => $webName,
-                                                topic => $topic,
-                                                params =>
-                                                  [ $who, $past, $future ] );
+                    throw TWiki::OopsException(
+                        'leaseconflict',
+                        def => $def,
+                        web => $webName,
+                        topic => $topic,
+                        keep => 1,
+                        params =>
+                          [ $who, $past, $future, 'edit' ] );
                 }
             }
         }
@@ -124,20 +127,23 @@
     # Prevent editing existing topic?
     if( $onlyNewTopic && $topicExists ) {
         # Topic exists and user requested oops if it exists
-        throw TWiki::OopsException( 'attention',
-                                    def => 'topic_exists',
-                                    web => $webName,
-                                    topic => $topic );
+        throw TWiki::OopsException(
+            'attention',
+            def => 'topic_exists',
+            web => $webName,
+            topic => $topic );
     }
 
     # prevent non-Wiki names?
     if( ( $onlyWikiName )
         && ( ! $topicExists )
         && ( ! TWiki::isValidTopicName( $topic ) ) ) {
-        # do not allow non-wikinames, redirect to view topic
-        # SMELL: this should be an oops, shouldn't it?
-        $session->redirect( $session->getScriptUrl( 1, 'view', $webName, $topic ));
-        return;
+         # do not allow non-wikinames
+        throw TWiki::OopsException( 'attention',
+                                    def => 'not_wikiword',
+                                    web => $webName,
+                                    topic => $topic,
+                                    params => [ $topic ] );
     }
 
     return ($session, $topicExists);
@@ -277,7 +283,7 @@
     $tmpl =~ s/%CMD%/$saveCmd/go;
     $session->enterContext( 'can_render_meta', $meta );
 
-    $tmpl = $session->handleCommonTags( $tmpl, $webName, $topic );
+    $tmpl = $session->handleCommonTags( $tmpl, $webName, $topic, $meta );
     $tmpl = $session->{renderer}->getRenderedVersion( $tmpl, $webName, $topic );
     # Don't want to render form fields, so this after getRenderedVersion
     my $formMeta = $meta->get( 'FORM' );
@@ -290,24 +296,27 @@
         # the query into the meta, overriding the values in the topic.
         my $formDef = new TWiki::Form( $session, $templateWeb, $form );
         unless( $formDef ) {
-            throw TWiki::OopsException( 'attention',
-                                        def => 'no_form_def',
-                                        web => $session->{webName},
-                                        topic => $session->{topicName},
-                                        params => [ $templateWeb, $form ] );
+            throw TWiki::OopsException(
+                'attention',
+                def => 'no_form_def',
+                web => $session->{webName},
+                topic => $session->{topicName},
+                params => [ $templateWeb, $form ] );
         }
-        $formDef->getFieldValuesFromQuery( $session->{cgiQuery}, $meta, 1 );
-        # and render them for editing
-        if ( $editaction eq "text" ) {
-            $formText = $formDef->renderHidden( $meta,
-                                                $getValuesFromFormTopic );
+        $formDef->getFieldValuesFromQuery( $session->{cgiQuery}, $meta );
+        # And render them for editing
+        # SMELL: these are both side-effecting functions, that will set
+        # default values for fields if they are not set in the meta.
+        # This behaviour really ought to be pulled out to a common place.
+        if ( $editaction eq 'text' ) {
+            $formText = $formDef->renderHidden( $meta );
         } else {
-            $formText = $formDef->renderForEdit( $webName, $topic, $meta,
-                                                 $getValuesFromFormTopic );
+            $formText = $formDef->renderForEdit( $webName, $topic, $meta );
         }
     } elsif( !$saveCmd && $session->{prefs}->getWebPreferencesValue( 'WEBFORMS', $webName )) {
         $formText = $session->{templates}->readTemplate( "addform", $skin );
-        $formText = $session->handleCommonTags( $formText, $webName, $topic );
+        $formText = $session->handleCommonTags(
+            $formText, $webName, $topic, $meta );
     }
     $tmpl =~ s/%FORMFIELDS%/$formText/g;
 
Index: twikiplugins/EditContrib/lib/TWiki/Contrib/EditContrib/Include41.pm
===================================================================
--- twikiplugins/EditContrib/lib/TWiki/Contrib/EditContrib/Include41.pm	(revision 13708)
+++ twikiplugins/EditContrib/lib/TWiki/Contrib/EditContrib/Include41.pm	(working copy)
@@ -130,7 +130,7 @@
 
     $text = TWiki::applyPatternToIncludedText( $text, $pattern ) if( $pattern );
 
-    $this->_expandAllTags( \$text, $includedTopic, $includedWeb );
+    $this->expandAllTags( \$text, $includedTopic, $includedWeb );
 
     # 4th parameter tells plugin that its called for an included file
     $this->{plugins}->commonTagsHandler( $text, $includedTopic,
@@ -138,7 +138,7 @@
 
     # We have to expand tags again, because a plugin may have inserted additional
     # tags.
-    $this->_expandAllTags( \$text, $includedTopic, $includedWeb );
+    $this->expandAllTags( \$text, $includedTopic, $includedWeb );
 
     # If needed, fix all 'TopicNames' to 'Web.TopicNames' to get the
     # right context
@@ -166,7 +166,7 @@
     }
 
     # handle tags again because of plugin hook
-    $this->_expandAllTags( \$text, $includedTopic, $includedWeb );
+    $this->expandAllTags( \$text, $includedTopic, $includedWeb );
 
     # restore the tags
     delete $this->{includes}->{$key};
