Modify

Opened 12 years ago

Closed 12 years ago

Last modified 5 years ago

#11008 closed defect (fixed)

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

Reported by: Laurent Lafon Owned by: Ryan J Ollos
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 12 years ago by l.lafon@…

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 12 years ago by Ryan J Ollos

(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 12 years ago by Ryan J Ollos

Owner: changed from Michael Henke to Ryan J Ollos
Status: newassigned

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 12 years ago by Ryan J Ollos

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 12 years ago by Ryan J Ollos

(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 12 years ago by Ryan J Ollos

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 12 years ago by Ryan J Ollos

(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 12 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

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 12 years ago by Ryan J Ollos

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 12 years ago by Michael Henke

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 12 years ago by Ryan J Ollos

Reporter: changed from l.lafon@… to Laurent Lafon

comment:12 Changed 12 years ago by Ryan J Ollos

Trac Release: 1.0

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

comment:13 Changed 12 years ago by Laurent Lafon

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 11 years ago by Ryan J Ollos

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.