Modify

Opened 9 months ago

Last modified 12 days ago

#11481 new defect

Browsing debug data nodes generates "Can't send unicode data" error with genshi-0.7

Reported by: lkraav Owned by: olemis
Priority: normal Component: TracDeveloperPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

Any other details needed?

Downgrading to 0.6 makes it work again.

See trac:#10126

Attachments (0)

Change History (7)

comment:1 Changed 9 months ago by olemis

yes, please ... Trac release ?

comment:2 Changed 9 months ago by lkraav

Hmm, trunk but I haven't pulled for a while now.

62b5507 - (origin/trunk, trunk) Merge r11675 from 1.0-stable (#11045) (11 months ago) <cboos>
Last edited 9 months ago by rjollos (previous) (diff)

comment:3 Changed 12 days ago by lkraav

This is definitely happening on latest 1.1.2b1 trunk right now.

comment:4 Changed 12 days ago by lkraav

I'm running tracd btw.

comment:5 Changed 12 days ago by lkraav

Same fix needed as [14006]

comment:6 Changed 12 days ago by jun66j5

I think we should just return template with data from process_request rather than rendering a template in the method. Trac core works well with both Genshi 0.6.x and 0.7.0.

  • tracdeveloperplugin/trunk/tracdeveloper/debugger.py

    diff --git a/tracdeveloperplugin/trunk/tracdeveloper/debugger.py b/tracdeveloperplugin/trunk/tracdeveloper/debugger.py
    index 94ed106..1f8a7a6 100644
    a b class TemplateDebugger(Component): 
    8686        key = token + ':' + path.split(':', 1)[0] 
    8787        data = self._cache.get(key) 
    8888        if not data: 
    89             raise HTTPNotFound() 
     89            raise HTTPNotFound("Not found '%s'" % path) 
    9090        node = data.lookup(path) 
    9191        data = {'node': node, 'drillable': self._is_drillable(req)} 
    92         output = Chrome(self.env).render_template(req, 'developer/debug_node.html', 
    93                                                   data, fragment=True) 
    94         req.send(output.render('xhtml'), 'text/html') 
     92        return 'developer/debug_node.html', data, None 
    9593 
    9694    # Internal methods 
    9795 

comment:7 Changed 12 days ago by jun66j5

Also, I think TemplateDebugger component must check whether a user has TRAC_DEVELOP permission.

  • tracdeveloperplugin/trunk/tracdeveloper/debugger.py

    diff --git a/tracdeveloperplugin/trunk/tracdeveloper/debugger.py b/tracdeveloperplugin/trunk/tracdeveloper/debugger.py
    index 94ed106..194d823 100644
    a b class TemplateDebugger(Component): 
    2828        return handler 
    2929 
    3030    def post_process_request(self, req, template, data, content_type): 
    31         if 'debug' not in req.args: 
     31        if 'debug' not in req.args or 'TRAC_DEVELOP' not in req.perm: 
    3232            return template, data, content_type 
    3333 
    3434        # Purge outdated debug info from cache 
    class TemplateDebugger(Component): 
    6767    # IRequestHandler methods 
    6868 
    6969    def match_request(self, req): 
    70         match = re.match(r'/developer/debug(?:/(.*))?$', req.path_info) 
    71         if match: 
    72             req.args['path'] = match.group(1) 
    73             return True 
     70        if 'TRAC_DEVELOP' in req.perm: 
     71            match = re.match(r'/developer/debug(?:/(.*))?$', req.path_info) 
     72            if match: 
     73                req.args['path'] = match.group(1) 
     74                return True 
    7475 
    7576    def process_request(self, req): 
    7677        header = req.get_header('X-Requested-With') 

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.