* looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-665 to compare with
* comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-665
M  MoinMoin/PageEditor.py

* modified files

--- orig/MoinMoin/PageEditor.py
+++ mod/MoinMoin/PageEditor.py
@@ -285,22 +285,35 @@
         
         self.request.write(self.request.formatter.startContent("content"))
         
-        # get the text body for the editor field
-        if form.has_key('template'):
-            # "template" parameter contains the name of the template page
-            template_page = wikiutil.unquoteWikiname(form['template'][0])
+        # Get the text body for the editor field.
+
+        # TODO: what about deleted pages? show the text of the last
+        # revision or use the template?
+
+        raw_body = ''
+        if self.exists():
+            # If the page exists, we get the text from the page.
+
+            # TODO: maybe warn if template argument was ignored becuase
+            # the page exists?
+            
+            raw_body = self.get_raw_body()
+        elif form.has_key('template'):
+            # If the page does not exists, we try to get the content
+            # from the template parameter.
+            template_page = form['template'][0]
             if self.request.user.may.read(template_page):
                 raw_body = Page(self.request, template_page).get_raw_body()
                 if raw_body:
-                    self.request.write(_("[Content of new page loaded from %s]") % (template_page,), '<br>')
+                    self.request.write(_("[Content of new page loaded from %s]") %
+                                       (template_page,), '<br>')
                 else:
-                    self.request.write(_("[Template %s not found]") % (template_page,), '<br>')
+                    self.request.write(_("[Template %s not found]") %
+                                       (template_page,), '<br>')
             else:
-                raw_body = ''
-                self.request.write(_("[You may not read %s]") % (template_page,), '<br>')
-        else:
-            raw_body = self.get_raw_body()
-
+                self.request.write(_("[You may not read %s]") %
+                                   (template_page,), '<br>')
+        
         # send text above text area
         template_param = ''
         if form.has_key('template'):



