; 5~@c@sUdZdklZdkZdkZdkZdkZdkZdkZdk Z dk l Z l Z dk l Z dklZdklZlZdklZdkZdklZd klZlZd klZd klZd klZl Z l!Z!l"Z"l#Z#d k$l%Z%ydk&l'Z(Wne)j o e*Z(nXye+Wne,j odZ+dZ-nXydk.l/Z0Wn6e)j o*dk1l2Z2dkl3Z3dZ0nXdZ4e Z5e5i6Z7e*dZ8dee eefdYZ9ee9dee eefdYZ:ee:dZ;defdYZ<ee<dS(stA simple implementation of a Message Catalog. $Id: GettextMessageCatalog.py,v 1.24 2004/07/02 13:45:10 fresh Exp $ (sGNUTranslationsN(s aq_parentsImplicit(sDateTime(sClassSecurityInfo(sviewsview_management_screens(sInitializeClass(s Traversable(s Persistents Overridable(sTabs(s BrokenClass(slogsRegistrysINFOsBLATHERsPROBLEM(sMsgfmt(sContextii(s OpenPTFile(sPageTemplateFile(s package_homecGst|dtijo$t|}t|d|dyti|id}Wntj o d}nX|SdS(s iiN(sossstatsselfs_pofilesmtimesIOError(sselfsmtime((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys _getModTimegs  cCs |iSdS(s N(sselfsid(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys getIdentifierpscCs |iSdS(s N(sselfsid(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysgetIdussgetErrorcCs |iSdS(s N(sselfserror(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysgetError{ssTitlecCs |iSdS(N(sselfstitle(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysTitlescCstii|iSdS(s$Get the size of the underlying file.N(sosspathsgetsizesselfs_pofile(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysget_sizescCst|}|i}|i}|i|y|it ||WnTt j o n@t i }tdt|||it|||nX|i|}t|do2|iid o|ii|iqndS(s Forcibly re-read the file sMessage Catalog has errorssRESPONSEsnoredirN(s aq_parentsselfsptssgetIdsnames_pofilespofiles _delObjects addCatalogsGettextMessageCatalogsOSErrorssyssexc_infosexcslogsPROBLEMsBrokenMessageCatalogs_getObshasattrsREQUESTsformshas_keysRESPONSEsredirects absolute_url(sselfsREQUESTsnamespofilesptssexc((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysreloads"     s file_existscCs,yt|id}Wn tSnXtSdS(Nsrb(sopensselfs_pofilesfilesFalsesTrue(sselfsfile((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys file_existss cCsdS(N((sselfsitems container((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysmanage_afterAddscCsdS(N((sselfsitems container((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysmanage_beforeDeletescCsdS(N((sselfsitem((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysmanage_afterClonesslabelsInfosactionss index_htmlswwwscatalog_broken(s__name__s __module__s__doc__s meta_typestitlesiconsClassSecurityInfossecuritysdeclareObjectProtectedsview_management_screenss__init__s _getModTimes getIdentifiersgetIdsdeclareProtectedsgetErrorsTitlesget_sizesNonesreloads file_existssmanage_afterAddsmanage_beforeDeletesmanage_afterClonesmanage_optionssptFilesglobalss index_html(((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysBrokenMessageCatalogWs,               sGettextMessageCatalogcBstZdZdZZdZeZeie e e dZ ddZ dZ e dZe dZeid e d Zd Zd Zd ZdZdZdZdZeie ddZdZedZdZdZdZ dZ!dZ"dZ#dZ$dZ%hdd<d d!t|id}g}z|i}Wd|iX|SdS(s,Read the data from the filesystem. srbN(sopensselfs_pofilesfilesdatas readlinessclose(sselfsreparsesdatasfile((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys _readFileEs cCsEtio7|i}||ijo||_|iqAndS(sqRefresh our contents from the filesystem if the file is newer and we are running in debug mode. N(sGlobalssDevelopmentModesselfs _getModTimesmtimes _mod_timesreload(sselfsmtime((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys _updateFromFSRs    cCs>yti|id}Wntj o d}nX|SdS(s iiN(sossstatsselfs_pofilesmtimesIOError(sselfsmtime((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys _getModTime]s  cCstii|iSdS(s$Get the size of the underlying file.N(sosspathsgetsizesselfs_pofile(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysget_sizefscCs|it|iSdS(sfReturn the last_modified date of the file we represent. Returns a DateTime instance. N(sselfs _updateFromFSsDateTimes _mod_time(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys getModTimejs cCs |iSdS(s(Return the path of the file we representN(sselfs_pofile(sself((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysgetObjectFSPathrscCsdS(N((sselfsitems container((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysmanage_afterAddyscCsdS(N((sselfsitems container((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysmanage_beforeDeletezscCsdS(N((sselfsitem((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pysmanage_afterClone{sslabelsInfosactionssTestszmi_tests index_htmlswwws catalog_infos catalog_tests file_existscCs,yt|id}Wn tSnXtSdS(Nsrb(sopensselfs_pofilesfilesFalsesTrue(sselfsfile((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys file_existss s getEncodingcCsWy?|id}|iddi}|idd}Wn d}nX|SdS(Ns content-types;is=sutf-8(sselfs getHeaders content_typessplitsstripsenc(sselfsencs content_type((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys getEncodings cCs'|i|ii}|i|SdS(N(sselfs_prepareTranslationss_v_tros_infosinfosgetsheader(sselfsheadersinfo((sq/mnt/gmirror/ports/www/zope-placelesstranslationservice/work/PlacelessTranslationService/GettextMessageCatalog.pys getHeaders  s displayInfocCs|iy|ii}Wn h}nX|i}|igi}|D]&}|hd|<d||<qN~hdd<d|i