Show
Ignore:
Timestamp:
03/12/08 14:32:47 (2 years ago)
Author:
JensDiemer
Message:

Filemanager:

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/plugins_internal/filemanager/filemanager.py

    r1411 r1482  
    5858from PyLucid.models import Page 
    5959from PyLucid.system.BasePlugin import PyLucidBasePlugin 
     60 
     61FILE_CHARSET = getattr(settings, "FILE_CHARSET", "UTF-8") 
    6062 
    6163#______________________________________________________________________________ 
     
    456458            content = f.read() 
    457459            f.close() 
     460            content = content.decode(FILE_CHARSET) 
    458461        except Exception, e: 
    459462            self.page_msg.red("Error, reading file:", e) 
     
    462465        if self.request.method != 'POST': 
    463466            form = EditFileForm({ 
    464                 "content": cgi.escape(content), 
     467                "content": content, 
    465468                "filename": self.path["filename"], 
    466469            }) 
     
    473476                abs_file_path = os.path.join(self.path["abs_path"], filename) 
    474477                try: 
     478                    content = content.encode(FILE_CHARSET) 
    475479                    f = file(abs_file_path, "w") 
    476480                    f.write(content) 
     
    505509            "filename": self.path["filename"], 
    506510            "form": form, 
    507  
     511            "charset": FILE_CHARSET, 
    508512        } 
    509513        self._render_template("edit_file", context)#, debug=True)