Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#10834 closed defect (fixed)

Internal Error when submitting a review

Reported by: roxana.macarie@… Owned by: Scott
Priority: normal Component: CodeReviewerPlugin
Severity: normal Keywords:
Cc: Scott Trac Release: 1.0

Description (last modified by Ryan J Ollos)

I'm using Trac 1.0, via Apache. Installation seems to go well and differences on the changesets are shown, but when I try to submit a review on a changeset I get an internal error:

AttributeError: 'NoneType' object has no attribute 'get_changeset'

... = I substituted the path to the file.

We have multiple repositories set, but a default repository is defined.

I do not have that much experience with python, so any help would be appreciated.

How to Reproduce

While doing a POST operation on /changeset/141/moduletest/..., Trac issued an internal error.

Request parameters:

{'__FORM_TOKEN': u'6cea3ac5ccb4e7227f291cfb',
 'new': u'141',
 'new_path': u'/moduletest/...',
 'reviewbutton': u'Submit review',
 'status': u'PASSED',
 'summary': u''}

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0

System Information

Trac 1.0
Agilo 1.3.9-pro
Genshi 0.6 (without speedups)
Mercurial 2.3.1
pysqlite 2.6.0
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
setuptools 0.6c11
SQLite 3.6.21
jQuery 1.7.2

Enabled Plugins

binary-agilo 1.3.9-pro
tracaccountmanager 0.4
traccodereviewer 0.0.2

Python Traceback

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\trac\web\", line 497, in _dispatch_request
  File "C:\Python27\lib\site-packages\trac\web\", line 224, in dispatch
    self._post_process_request(req, *resp)
  File "C:\Python27\lib\site-packages\trac\web\", line 338, in _post_process_request
    resp = f.post_process_request(req, *resp)
  File "build\bdist.win32\egg\coderev\", line 59, in post_process_request
    tickets = self._update_tickets(req, review)
  File "build\bdist.win32\egg\coderev\", line 127, in _update_tickets
    changeset = repo.get_changeset(review.changeset)
AttributeError: 'NoneType' object has no attribute 'get_changeset'

Attachments (0)

Change History (11)

comment:1 Changed 4 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 4 years ago by anonymous

I have some error.

comment:3 Changed 4 years ago by achernov@…

I have some error.

comment:4 Changed 3 years ago by Scott

Cc: Scott added; anonymous removed

comment:5 Changed 3 years ago by Scott

This patch worked for me:

  • codereviewerplugin/0.12/coderev/

    diff --git a/codereviewerplugin/0.12/coderev/ b/codereviewerplugin/0.12/coderev/
    index 5e22e11..e2de454 100644
    a b class CodeReviewerModule(Component): 
    122122        comment += " for [%(_ref)s]:\n\n%(summary)s" % summary
    124124        # find and update tickets
    125         # TODO: handle when there's no explicitly named repo
    126         repo = RepositoryManager(self.env).get_repository(review.repo)
     125        rm = RepositoryManager(self.env)
     126        new_path = req.args.get('new_path')
     127        reponame = req.args.get('reponame')
     128        if reponame:
     129            repo = rm.get_repository(reponame)
     130        else:
     131            reponame, repo, new_path = rm.get_repository_by_path(new_path)
    127132        changeset = repo.get_changeset(review.changeset)
    128133        ticket_re = CommitTicketUpdater.ticket_re
    129134        tickets = ticket_re.findall(changeset.message)         
Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:6 Changed 3 years ago by Ryan J Ollos

I haven't been able to reproduce. Could you describe how the repository is configured?

  • Is the repository defined in trac.ini, or through the web administration page and stored in the database?
  • Do you have multiple repositories defined? If so, does the issue only occur for some repositories? Does it occur for the default repository?

I was a bit confused by the patch in comment:5, so I edited it. Does it look correct to you now?

comment:7 in reply to:  6 Changed 3 years ago by Scott

Replying to rjollos:

Here are the relevant trac.ini entries:

repository_dir = /sysadm/svn/svip/vlab_svip_ocp
repository_sync_per_request = (default)
repository_type = svn

We are using the system httpd with multiple Trac instances, but only one repository for each instance. I have only tried the plugin on this instance.

The edited comment:5 patch looks correct.

The patch is based on this code in

comment:8 Changed 3 years ago by Ryan J Ollos

Owner: changed from Rob Guttman to Ryan J Ollos
Status: newaccepted

comment:9 Changed 3 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 13695:

Support default (not explicitly named) repositories. Fixes #10834. Patch by hackonteur.

comment:10 Changed 3 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to Scott

comment:11 Changed 3 years ago by Ryan J Ollos

In 13696:

Bump version to 0.0.3. Refs #10357, #10834.

Modify Ticket

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