Modify

Opened 16 months ago

Closed 16 months ago

Last modified 12 months ago

#11008 closed defect (fixed)

ValueError: invalid literal for int() with base 10: '1-1365164833531889'

Reported by: Laurentlafon Owned by: rjollos
Priority: low Component: PrivateCommentPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

Hello,

I'm new to trac and I'm trying to setup an environnement that my clients will be able to access. So I need to be able to set some comments private.

I've followed the setup as described but I've come up with an error "invalid literal for int()". I'm using trac with tracdb. Could that be the problem ?

Thanks for your help,

Laurent

How to Reproduce

While doing a GET operation on /ticket/4, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'id': u'4'}

User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/11.04 Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19

System Information

Trac 1.0.1
Babel 0.9.6
Genshi 0.6 (with speedups)
pysqlite 2.6.0
Python 2.7.1+ (r271:86832, Sep 27 2012, 21:12:17)
[GCC 4.5.2]
RPC 1.1.2-r12546
setuptools 0.6
SQLite 3.7.4
jQuery 1.7.2

Enabled Plugins

privatecomments 0.3
TracAccountManager 0.4.3
TracHTTPAuth 1.1
TracIniAdminPanel 0.81beta-r533
TracXMLRPC 1.1.2-r12546

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 233, in dispatch
    content_type)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py", line 1015, in render_template
    encoding='utf-8')
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 183, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/usr/lib/pymodules/python2.7/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "/usr/lib/pymodules/python2.7/genshi/output.py", line 339, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/pymodules/python2.7/genshi/output.py", line 826, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/pymodules/python2.7/genshi/output.py", line 670, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/pymodules/python2.7/genshi/output.py", line 771, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/usr/lib/pymodules/python2.7/genshi/output.py", line 586, in __call__
    for ev in stream:
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py", line 1152, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py", line 1141, in _generate
    for kind, data, pos in stream:
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 686, in _unmark
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 1081, in __call__
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 117, in __iter__
    event = self.stream.next()
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 714, in __call__
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 779, in __call__
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 1107, in __call__
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 117, in __iter__
    event = self.stream.next()
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 714, in __call__
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 682, in _mark
    for event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 686, in _unmark
    for mark, event in stream:
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 1059, in __call__
    for subevent in self._inject():
  File "/usr/lib/pymodules/python2.7/genshi/filters/transform.py", line 1042, in _inject
    content = content()
  File "/usr/local/lib/python2.7/dist-packages/privatecomments-0.3-py2.7.egg/privatecomments/privatecomments.py", line 165, in check_comments
    comment_private = self._is_comment_private(ticket_id,comment_id)
  File "/usr/local/lib/python2.7/dist-packages/privatecomments-0.3-py2.7.egg/privatecomments/privatecomments.py", line 224, in _is_comment_private
    (int(ticket_id),int(comment_id))
ValueError: invalid literal for int() with base 10: '1-1365164833531889'

Attachments (0)

Change History (14)

comment:1 Changed 16 months ago by l.lafon at cacom.fr

I forgot to mention : even if I add the rights 'PRIVATE_COMMENT_VIEW' to my user and I'm creating a new ticket and still cannot see the checkbox. Weird...

comment:3 Changed 16 months ago by rjollos

(In [12958]) Refs #11008:

  • Use proper parameter passing and SQL statement formatting to avoid SQL injection.
  • Added support for new format of comment_id in Trac 1.0, fixing a ValueError traceback.
  • Remove debug level printing of SQL statements, since Trac has implicit support for printing SQL queries through the trac.debug_sql configuration parameter (see t:TracIni#trac-section).

comment:4 Changed 16 months ago by rjollos

  • Owner changed from mhenke to rjollos
  • Status changed from new to assigned

Confirmed. String formatting in SQL statements is bad news. See t:TracDev/DatabaseApi#GuidelinesforSQLStatements for more info.

I'll commit a patch so that you can continue using the plugin, and hope that mhenke is okay with that.

comment:5 Changed 16 months ago by rjollos

After [12958], there is no longer a ValueError on Trac 1.0, but the checkbox still does not appear. Most likely, the relevant HTML structure of the ticket page changed in 1.0, and the XPath selector of the Genshi Transformer just needs to be updated. I can't fix that right now, but I'll try to find time to do it later today.

comment:5 Changed 16 months ago by rjollos

(In [12959]) Refs #11008:

  • Various PEP8 changes.
  • Modified entry point.
  • Removed multiple instances of cursor.close. It is not necessary to close the cursor.

comment:6 Changed 16 months ago by rjollos

Side note: Great that you are using the latest version of AccountManagerPlugin. You might want to be aware that there is a newer version of TracIniAdminPanelPlugin, now hosted on trac-hacks.

comment:7 Changed 16 months ago by rjollos

(In [12960]) Refs #11008:

  • Get ticket id from request args rather than parsing it out of the path.
  • Wrap checkbox with a label so that clicking on the label toggles the checkbox.
  • Refactored request argument handling for improved clarity.
  • PEP8 changes.

comment:8 Changed 16 months ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

Extensive changes will be needed for Trac 1.0, see #11010. I won't have time to make those changes soon, so I've described what I've found so far in that ticket. The plugin should at least work well in Trac 0.12, and the code has been improved, I hope

comment:9 Changed 16 months ago by rjollos

mhenke: I noticed you checked-in some changes in [12976]. Did you have a chance to test the recent fixes and confirm they are working okay?

comment:10 Changed 15 months ago by mhenke

Actually I only committed a patch a coworker of mine made, no testing whatsoever from my side. But he probably did :)
Also I am perfectly ok with you taking over maintainership.

comment:11 Changed 15 months ago by rjollos

  • Reporter changed from l.lafon at cacom.fr to Laurentlafon

comment:12 Changed 15 months ago by rjollos

  • Trac Release set to 1.0

Thanks, I'll take care to address new issues from users and commit fixes when appropriate.

comment:13 follow-up: Changed 14 months ago by Laurentlafon

Hello,

I removed my customised template, installed the plugin after having edited in the line for Trac 1.0 as such :

           # if the user has the private comment permission the checkboxes
            # to change the private value will be added
            if has_private_permission:
                comment_box = tag.label(_("Private Comment:"),
                                        tag.input(type='checkbox',
                                                  name='private_comment'))
                # stream |= Transformer('//h2[@id="trac-add-comment"]') \
                #     .after(comment_box)
                # Trac 1.0 and later:
                stream |= Transformer(
                   '//div[@id="trac-add-comment"]//fieldset').prepend(input)

I got an EOFError: EOF when reading a line. error :

Fichier « /usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py », ligne 497, dans _dispatch_request
Fichier « /usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py », ligne 233, dans dispatch
Fichier « /usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py », ligne 1015, dans render_template
Fichier « /usr/lib/pymodules/python2.7/genshi/core.py », ligne 183, dans render
Fichier « /usr/lib/pymodules/python2.7/genshi/output.py », ligne 58, dans encode
Fichier « /usr/lib/pymodules/python2.7/genshi/output.py », ligne 339, dans __call__
Fichier « /usr/lib/pymodules/python2.7/genshi/output.py », ligne 826, dans __call__
Fichier « /usr/lib/pymodules/python2.7/genshi/output.py », ligne 670, dans __call__
Fichier « /usr/lib/pymodules/python2.7/genshi/output.py », ligne 771, dans __call__
Fichier « /usr/lib/pymodules/python2.7/genshi/output.py », ligne 586, dans __call__
Fichier « /usr/lib/pymodules/python2.7/genshi/core.py », ligne 288, dans _ensure
Fichier « /usr/lib/pymodules/python2.7/genshi/core.py », ligne 288, dans _ensure
Fichier « /usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py », ligne 1152, dans _strip_accesskeys
Fichier « /usr/lib/pymodules/python2.7/genshi/core.py », ligne 288, dans _ensure
Fichier « /usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/chrome.py », ligne 1141, dans _generate
Fichier « /usr/lib/pymodules/python2.7/genshi/core.py », ligne 288, dans _ensure
Fichier « /usr/lib/pymodules/python2.7/genshi/core.py », ligne 288, dans _ensure
Fichier « /usr/lib/pymodules/python2.7/genshi/filters/transform.py », ligne 686, dans _unmark
Fichier « /usr/lib/pymodules/python2.7/genshi/filters/transform.py », ligne 1133, dans __call__
Fichier « /usr/lib/pymodules/python2.7/genshi/filters/transform.py », ligne 1042, dans _inject

Just installing the latest version available of the plugin and i have the same problem as before : the checkbox is not visible on the comment box.

Maybe I've missed something ?

Thanks for your help,

Laurent

comment:14 in reply to: ↑ 13 Changed 12 months ago by rjollos

Replying to Laurentlafon:

I removed my customised template, installed the plugin after having edited in the line for Trac 1.0 as such :

I'm not sure. It wasn't working with Trac 1.0, so I created #11010 and hope to fix it in the future. It should work with Trac 0.12.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from rjollos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.