Hello folks,


today I decided to update my 0.6something to CVS. The first thing I found was
a bug ;-)

The PSP Servlet engine writes a temp file in /tmp and later os.rename()s it to
the actual servlet file.

If /tmp and Webware are not on the same file system, this will fail.
Of course I have no idea how long the bug is already there.

The single line fix below provides a quick solution. Finding a perhaps more
appropriate temp dir may be up to Chuck or Geoff or whoever maintains PSP.
The diff is also attached.

Thanks,
       Fionn

    --------8<----------------8<---------------8<---------------8<-------

*** ServletWriter.py.orig       Thu Feb  7 18:46:53 2002
--- ServletWriter.py    Thu Feb  7 19:00:25 2002
***************
*** 33,52 ****
--- 33,53 ----

        ''' This file creates the servlet source code. Well, it writes it out
to a file at least.'''

        TAB = '\t'
        SPACES = '    ' # 4 spaces
        EMPTY_STRING=''

        def __init__(self,ctxt):

                self._pyfilename = ctxt.getPythonFileName()
+               tempfile.tempdir = os.path.dirname(self._pyfilename)
                self._temp = tempfile.mktemp('tmp')
                self._filehandle = open(self._temp,'w+')
                self._tabcnt = 0
                self._blockcount = 0 # a hack to handle nested blocks of
python code
                self._indentSpaces = self.SPACES
                self._useTabs=1
                self._useBraces=0
                self._indent='\t'
                self._userIndent = self.EMPTY_STRING

*** ServletWriter.py.orig       Thu Feb  7 18:46:53 2002
--- ServletWriter.py    Thu Feb  7 19:00:25 2002
***************
*** 33,52 ****
--- 33,53 ----
      
        ''' This file creates the servlet source code. Well, it writes it out to a fi
le at least.'''
  
        TAB = '\t'
        SPACES = '    ' # 4 spaces
        EMPTY_STRING=''
      
        def __init__(self,ctxt):
        
                self._pyfilename = ctxt.getPythonFileName()
+               tempfile.tempdir = os.path.dirname(self._pyfilename)
                self._temp = tempfile.mktemp('tmp')
                self._filehandle = open(self._temp,'w+')
                self._tabcnt = 0
                self._blockcount = 0 # a hack to handle nested blocks of python code
                self._indentSpaces = self.SPACES
                self._useTabs=1
                self._useBraces=0
                self._indent='\t'
                self._userIndent = self.EMPTY_STRING
  

Reply via email to