def po_file(self):
        """Return the parsed .po file that is currently being translated/viewed.

        (Note that this parsing also involves marking up each entry with a hash
        of its contents.)
        """
        if self.po_file_is_writable:
            # If we can write changes to file, then we pull it up fresh with
            # each request.
            # XXX: brittle; what if this path doesn't exist? Isn't a .po file?
            po_file = pofile(self.po_file_path,
                             wrapwidth=rosetta_settings.POFILE_WRAP_WIDTH)
            for entry in po_file:
                # Entry is an object representing a single entry in the catalog.
                # We interate through the *entire catalog*, pasting a hashed
                # value of the meat of each entry on its side in an attribute
                # called "md5hash".
                str_to_hash = (
                    six.text_type(entry.msgid) +
                    six.text_type(entry.msgstr) +
                    six.text_type(entry.msgctxt or '')
                ).encode('utf8')
                entry.md5hash = hashlib.md5(str_to_hash).hexdigest()
        else:
            storage = get_storage(self.request)
            po_file = storage.get(self.po_file_cache_key, None)
            if not po_file:
                po_file = pofile(self.po_file_path)
                for entry in po_file:
                    # Entry is an object representing a single entry in the
                    # catalog. We interate through the entire catalog, pasting
                    # a hashed value of the meat of each entry on its side in
                    # an attribute called "md5hash".
                    str_to_hash = (
                        six.text_type(entry.msgid) +
                        six.text_type(entry.msgstr) +
                        six.text_type(entry.msgctxt or '')
                    ).encode('utf8')
                    entry.md5hash = hashlib.new('md5', str_to_hash).hexdigest()
                storage.set(self.po_file_cache_key, po_file)
        return po_file
def po_file ( self ) : if self . po_file_is_writable : po_file = pofile ( self . po_file_path , wrapwidth = rosetta_settings . POFILE_WRAP_WIDTH ) for entry in po_file : str_to_hash = ( six . text_type ( entry . msgid ) + six . text_type ( entry . msgstr ) + six . text_type ( entry . msgctxt or '' ) ) . encode ( 'utf8' ) entry . md5hash = hashlib . md5 ( str_to_hash ) . hexdigest ( ) else : storage = get_storage ( self . request ) po_file = storage . get ( self . po_file_cache_key , None ) if not po_file : po_file = pofile ( self . po_file_path ) for entry in po_file : str_to_hash = ( six . text_type ( entry . msgid ) + six . text_type ( entry . msgstr ) + six . text_type ( entry . msgctxt or '' ) ) . encode ( 'utf8' ) entry . md5hash = hashlib . new ( 'md5' , str_to_hash ) . hexdigest ( ) storage . set ( self . po_file_cache_key , po_file ) return po_file
Return the parsed .po file that is currently being translated/viewed.

        (Note that this parsing also involves marking up each entry with a hash
        of its contents.)