Edgewall Software

Ticket #7748: 7748-disable-enscript-r7716.patch

File 7748-disable-enscript-r7716.patch, 952 bytes (added by rblank, 3 years ago)

Patch against 0.11-stable disabling enscript after the first execution error

  • trac/mimeview/enscript.py

    old new  
    119119 
    120120    def __init__(self): 
    121121        self._types = None 
     122        self._available = True 
    122123 
    123124    # IHTMLPreviewRenderer methods 
    124125 
    125126    def get_quality_ratio(self, mimetype): 
    126127        # Extend default MIME type to mode mappings with configured ones 
     128        if not self._available: 
     129            return 0 
    127130        if not self._types: 
    128131            self._types = {} 
    129132            self._types.update(types) 
     
    140143 
    141144        np = NaivePopen(cmdline, content.encode('utf-8'), capturestderr=1) 
    142145        if np.errorlevel or np.err: 
     146            self._available = False 
    143147            err = 'Running (%s) failed: %s, %s.' % (cmdline, np.errorlevel, 
    144148                                                    np.err) 
    145149            raise Exception, err