Modify

Opened 13 months ago

Closed 5 months ago

#14257 closed defect (fixed)

Python error with boxes in TRAC 1.6

Reported by: clemens Owned by: Mikael Relbe
Priority: normal Component: WikiExtrasPlugin
Severity: normal Keywords:
Cc: clemens Trac Release: 1.6

Description

WikiExtrasPlugin has an problem with TRAC 1.6.

I have been using the great WikiExtrasPlugin under TRAC 1.4 for many years. Now after upgrading to TRAC 1.6 it does not run anymore. Might be a problem with the "boxes" component (boxes.py).

I am running the current version "1.3.2dev" i.e. revision r18475 of the plugin which is marked as "compatible with Python 3". My TRAC is the current 1.6 release, running under Linux (Debian 12) with Python 3.11.

Error message is logged as follows:

Trac[main] ERROR: [127.0.0.1] Internal Server Error: <RequestWithSession "GET '/wikiextras/dynamicboxes.css'">, referrer 'http://localhost:8000/first/'
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/trac/web/main.py", line 609, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python3.11/dist-packages/trac/web/main.py", line 301, in dispatch
    raise e
  File "/usr/local/lib/python3.11/dist-packages/trac/web/main.py", line 247, in dispatch
    resp = chosen_handler.process_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tracwikiextras/boxes.py", line 144, in process_request
    req.send(csstext, 'text/css', status=200)
  File "/usr/local/lib/python3.11/dist-packages/trac/web/api.py", line 875, in send
    self._send(content, content_type, status)
  File "/usr/local/lib/python3.11/dist-packages/trac/web/api.py", line 1011, in _send
    self.write(content)
  File "/usr/local/lib/python3.11/dist-packages/trac/web/api.py", line 971, in write
    raise ValueError("Can't send str content")
ValueError: Can't send str content

Please note the boxes.py in above error message. I found out that disabling the "boxes" component in WikiExtrasPlugin in trac.ini make the problem disappear. Hence I believe that there seems to be a problem with the "boxes" component.

[components]
...
tracwikiextras.phrases.aboutwikiphrases = enabled
tracwikiextras.phrases.phrases = enabled
tracwikiextras.boxes.aboutwikiboxes = disabled
tracwikiextras.boxes.boxes = enabled <<<<<<< "disabled" makes the problem go away
tracwikiextras.color.color = enabled
tracwikiextras.entities.entities = disabled
tracwikiextras.icons.aboutwikiicons = disabled
tracwikiextras.icons.icons = disabled
tracwikiextras.icons.showicons = disabled
tracwikiextras.icons.smileys = disabled
tracwikiextras.symbols.symbols = disabled
tracwikiextras.unc_paths.uncpathlink = disabled

Attachments (0)

Change History (5)

comment:1 Changed 13 months ago by clemens

Cc: clemens added

comment:2 Changed 13 months ago by Jun Omae

Try the following patch:

  • tracwikiextras/boxes.py

    diff --git a/tracwikiextras/boxes.py b/tracwikiextras/boxes.py
    index f8a853ec6..f911ffd5d 100755
    a b class Boxes(Component): 
    141141        else:
    142142            csstext += '.wiki-toc { width: auto !important; }\n'
    143143
     144        if not isinstance(csstext, bytes):
     145            csstext = csstext.encode('utf-8')
    144146        req.send(csstext, 'text/css', status=200)
    145147
    146148        return None

comment:3 in reply to:  2 Changed 13 months ago by clemens

Replying to Jun Omae:

The patch works. The error is gone. Good!

(Sorry for late reply. Currently I cannot receive e-mail notifications about ticket changes from Trac-Hacks. See my question in the mailing list...)

Clemens

comment:4 Changed 5 months ago by clemens

I would say, the ticket can be closed; since the problem has been resolved with r18604 by jun66j5 on 2023-12-16.

comment:5 Changed 5 months ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Mikael Relbe.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.