[Mailman-Developers] edithtml bug...
The Dragon De Monsyne
dragondm@delta.integral.org
Wed, 19 Aug 1998 09:36:38 -0500 (CDT)
I just stumbled upon a bug that prevents edithtml from working in
1.0b5. (It refuses to accept any password. )
Here's a patch:
*** /usr/src/mailman-1.0b5/Mailman/HTMLFormatter.py Mon Jul 27 17:48:31 1998
--- HTMLFormatter.py Wed Aug 19 09:16:34 1998
***************
*** 29,39 ****
class HTMLFormatter:
def InitVars(self):
if self._internal_name:
! self._template_dir = os.path.join(mm_cfg.LIST_DATA_DIR,
! self._internal_name)
else:
! self._template_dir = mm_cfg.TEMPLATE_DIR
def GetMailmanFooter(self):
owners_html = Container()
--- 29,47 ----
class HTMLFormatter:
def InitVars(self):
+ pass
+ # if self._internal_name:
+ # self._template_dir = os.path.join(mm_cfg.LIST_DATA_DIR,
+ # self._internal_name)
+ # else:
+ # self._template_dir = mm_cfg.TEMPLATE_DIR
+
+ def GetTemplateDir(self):
if self._internal_name:
! return os.path.join(mm_cfg.LIST_DATA_DIR, self._internal_name)
else:
! return mm_cfg.TEMPLATE_DIR
!
def GetMailmanFooter(self):
owners_html = Container()
***************
*** 58,65 ****
def SnarfHTMLTemplate(self, file):
# XXX: hack, blech, yuk
! HTMLFormatter.InitVars(self)
! filename = os.path.join(self._template_dir, file)
f = open(filename,'r')
str = f.read()
f.close()
--- 66,74 ----
def SnarfHTMLTemplate(self, file):
# XXX: hack, blech, yuk
! # HTMLFormatter.InitVars(self)
! # Yoiks! that was ugly! -ddm
! filename = os.path.join(self.GetTemplateDir(), file)
f = open(filename,'r')
str = f.read()
f.close()
***************
*** 332,342 ****
return item[-5:] == '.html'
files = filter(ExtensionFilter, os.listdir(mm_cfg.TEMPLATE_DIR))
! Utils.MakeDirTree(self._template_dir)
for filename in files:
file1 = open(os.path.join(mm_cfg.TEMPLATE_DIR, filename), 'r')
text = file1.read()
file1.close()
! file2 = open(os.path.join(self._template_dir, filename), 'w+')
file2.write(text)
file2.close()
--- 341,351 ----
return item[-5:] == '.html'
files = filter(ExtensionFilter, os.listdir(mm_cfg.TEMPLATE_DIR))
! Utils.MakeDirTree(self.GetTemplateDir())
for filename in files:
file1 = open(os.path.join(mm_cfg.TEMPLATE_DIR, filename), 'r')
text = file1.read()
file1.close()
! file2 = open(os.path.join(self.GetTemplateDir(), filename), 'w+')
file2.write(text)
file2.close()
*** /usr/src/mailman-1.0b5/Mailman/Cgi/edithtml.py Mon Jul 27 17:48:31 1998
--- Cgi/edithtml.py Wed Aug 19 09:26:59 1998
***************
*** 20,26 ****
import sys
import os, cgi, string, types
! from Mailman import Utils, MailList
from Mailman import htmlformat
--- 20,26 ----
import sys
import os, cgi, string, types
! from Mailman import Utils, MailList, Errors
from Mailman import htmlformat
***************
*** 38,44 ****
('subscribe.html', 'Subscribe results page'),
('options.html', 'User specific options page'),
('handle_opts.html', 'Changing user options results page'),
! ('archives.html', 'Archives index page')
)
--- 38,44 ----
('subscribe.html', 'Subscribe results page'),
('options.html', 'User specific options page'),
('handle_opts.html', 'Changing user options results page'),
! ('roster.html', 'List roster page')
)
***************
*** 56,62 ****
try:
list = MailList.MailList(list_name, lock=0)
! except:
doc.AddItem(htmlformat.Header(2, "%s : No such list" % list_name))
print doc.Format()
sys.exit(0)
--- 56,62 ----
try:
list = MailList.MailList(list_name, lock=0)
! except Errors.MMUnknownListError:
doc.AddItem(htmlformat.Header(2, "%s : No such list" % list_name))
print doc.Format()
sys.exit(0)
***************
*** 110,116 ****
try:
list.ConfirmAdminPassword(cgi_data['adminpw'].value)
ChangeHTML(list, cgi_data, template_name, doc)
! except:
m = 'Error: Incorrect admin password.'
doc.AddItem(htmlformat.Header(3,
htmlformat.Italic(
--- 110,116 ----
try:
list.ConfirmAdminPassword(cgi_data['adminpw'].value)
ChangeHTML(list, cgi_data, template_name, doc)
! except Errors.MMBadPasswordError:
m = 'Error: Incorrect admin password.'
doc.AddItem(htmlformat.Header(3,
htmlformat.Italic(
***************
*** 130,136 ****
pass
-
def InitDocument():
return htmlformat.HeadlessDocument()
--- 130,135 ----
***************
*** 176,182 ****
doc.AddItem('<hr>')
return
code = cgi_info['html_code'].value
! f = open(os.path.join(list._template_dir, template_name), 'w')
f.write(code)
f.close()
doc.AddItem(htmlformat.Header(3, 'HTML successfully updated.'))
--- 175,181 ----
doc.AddItem('<hr>')
return
code = cgi_info['html_code'].value
! f = open(os.path.join(list.GetTemplateDir(), template_name), 'w')
f.write(code)
f.close()
doc.AddItem(htmlformat.Header(3, 'HTML successfully updated.'))
-The Dragon De Monsyne