AUTHENTICATED_USER considered harmfull :)
Having just spent 2 days debugging a Zope 2.0 problem (due to my own stupidity) I finally fixed the problem by changing one of the dozens of references to AUTHENTICATED_USER to AUTHENTICATED_USER.name - the first of course returns a user object, the second returns a text string. This is something to watch out for, as of course a <dtml-var AUTHENTICATED_USER> prints out a string (which does NOT mean it contains one, it just means iut renders as one!) and therefore this problem can be non-obvious.. i know this has been posted before, but newbies like myself meed constant reminders :) BTW, in another direction, has does anyone know why the default DTML in Zope 2.0 atr formated in the old style, not the new <dtml-var > style? I prefer the later a LOT, but cannot usually be bothered changing the default contents (too busy adding great new bits ;) -- ------------------------------------------------------------ Stuart Woolford, stuartw@newmail.net Unix Consultant. Software Developer. Supra Club of New Zealand. ------------------------------------------------------------
Stuart Woolford wrote:
BTW, in another direction, has does anyone know why the default DTML in Zope 2.0 atr formated in the old style, not the new <dtml-var > style? I prefer the later a LOT, but cannot usually be bothered changing the default contents (too busy adding great new bits ;)
Just didn't have time, sounds trivial but it didn't happen before the release did. Perhaps you'd like to provide a set of patches? This would be very helpful. You might be surprised how much DTML shows up embeded in the Zope source code, but you could probably sniff it all out with grep and Emacs. -Michel
-- ------------------------------------------------------------ Stuart Woolford, stuartw@newmail.net Unix Consultant. Software Developer. Supra Club of New Zealand. ------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
Michel Pelletier wrote:
Stuart Woolford wrote:
BTW, in another direction, has does anyone know why the default DTML in Zope 2.0 atr formated in the old style, not the new <dtml-var > style? I prefer the later a LOT, but cannot usually be bothered changing the default contents (too busy adding great new bits ;)
Just didn't have time, sounds trivial but it didn't happen before the release did.
Perhaps you'd like to provide a set of patches? This would be very helpful. You might be surprised how much DTML shows up embeded in the Zope source code, but you could probably sniff it all out with grep and Emacs.
It seems that running the following script in your Zope2 root does it ------8<------ cut here -------8<-------- #!/usr/bin/python import os,string,re rx_close = re.compile('<!--#[ \t]*(/|end)(.*?)-->',re.DOTALL) rx_open = re.compile('<!--#(.*?)-->',re.DOTALL) def visit(arg,dirname,names): py_files = filter(lambda x:x[-3:] == '.py',names) dtml_files = filter(lambda x:x[-5:] == '.dtml',names) for filename in py_files+dtml_files: newsyntax(dirname,filename) def make_close(match): return '</dtml-%s>' % match.group(2) def make_open(match): return '<dtml-%s>' % match.group(1) def newsyntax(path,filename): fullpath = os.path.join(path,filename) data = open(fullpath).read() data1 = rx_close.sub(make_close,data) data1 = rx_open.sub(make_open,data1) if data != data1: print path,filename os.rename(fullpath,fullpath+'.orig') open(fullpath, 'w').write(data1) open(fullpath+'.new', 'w').write(data1) os.path.walk('lib/python',visit,None) ------8<------ cut here -------8<-------- Hannu
Hannu Krosing wrote:
Michel Pelletier wrote:
Perhaps you'd like to provide a set of patches? This would be very helpful. You might be surprised how much DTML shows up embeded in the Zope source code, but you could probably sniff it all out with grep and Emacs.
It seems that running the following script in your Zope2 root does it
Unfortunatly it changes some files that should not be changed, and thus the old syntax is not recognized any more. It should be easy to fix by someone in the know by just copying back the .orig files ---------------- Hannu
Hannu Krosing wrote:
Hannu Krosing wrote:
Michel Pelletier wrote:
Perhaps you'd like to provide a set of patches? This would be very helpful. You might be surprised how much DTML shows up embeded in the Zope source code, but you could probably sniff it all out with grep and Emacs.
It seems that running the following script in your Zope2 root does it
Unfortunatly it changes some files that should not be changed, and thus the old syntax is not recognized any more.
It should be easy to fix by someone in the know by just copying back the .orig files
Seems it were lines 109 and 111 in lib/python/DocumentTemplate/DT_HTML.py that should be converted back to old syntax to look like this: if text[s:s+5] == '<!--#': n=s+5 e=find(text,'-->',n) ----------------- Hannu
participants (3)
-
Hannu Krosing -
Michel Pelletier -
Stuart Woolford