[Zope] VisualCMS - error in adding site

Jaroslav Lukesh lukesh at seznam.cz
Mon Sep 15 04:22:36 EDT 2003


> Odesílatel: Dieter Maurer <dieter at handshake.de>
>  > Error Type: TALESError
>  > Error Value: exceptions.NameError on global name 'HUSER' is not
defined in
>  > "", at line 2, column 1
>  > 
>  > ...
>  >
Files\zope-web\lukesh251\lib\python\Products\AtlantisBlueCMS\CMSPage.py,
>  > line 338, in browserType
>
> Look at line 338 of "CMSPage.py". It references undefined "HUSER".
> Fix it.

I was make little data mining about HUSER. It is same code (with different
name)as User agent sniffer from ZopeLabs tip at
www.zopelabs.com\cookbook\990728167\, but here are no note about "HUSER"
too. So I think that it is undocumented system call (see to date of this
tip), but it seems that no-no.:

Re: Improvements by ruckc - 2001-07-17 
I modified it for versioning in MSIE, ms3, ms4, ms5, ms6.

Sorry for the lack of formatting.

def whichBrowser(self, ident):
   if ( (string.find(ident, 'MSIE') == -1)   and (string.find(ident,
'Mozilla') >= 0 ) ):
      if ( (string.find(ident, 'Gecko') > -1 )) :
          ident = 'nn6'
      else:
          ident = 'nn4'
   elif (string.find(ident, 'MSIE') >= 0):
      ident = 'ms'
      thestr=int(HUSER[ind+4] + HUSER[ind+5])
      if(thestr >= 3):
         ver = 3
      elif(thestr >= 4):
         ver = 4
      elif(thestr >= 5):
         ver = 5
      elif(thestr >= 6):
         ver = 6
      if(ver) ident = ident+str(ver)
   else:
      ident = 'unknown'
   return ident

I was make little tweak:

          #thestr=int(HUSER[ind+4] + HUSER[ind+5])
          thestr=4

It works in Zope, but browser (MSIE4) give me JS errors that makes pages
not usable. 

Does original code for somebody works?

> Upgrade to Zope 2.6.2 as soon as you can. Tracebacks (for ZPT, but not
> DTML) will become much more readable.

I have lot of changes in sources of my 2.5.1 to handle correctly
windows-1250 codepage at all situations. Some code is taken from Zope 2.6.2
(STX handling + some mods), so upgrade would be really painfull. 

Regards, JL.



More information about the Zope mailing list