Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 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
tracmercurial 1.0.0.3dev

Python Traceback

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\trac\web\main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "C:\Python27\lib\site-packages\trac\web\main.py", line 224, in dispatch
    self._post_process_request(req, *resp)
  File "C:\Python27\lib\site-packages\trac\web\main.py", line 338, in _post_process_request
    resp = f.post_process_request(req, *resp)
  File "build\bdist.win32\egg\coderev\web_ui.py", line 59, in post_process_request
    tickets = self._update_tickets(req, review)
  File "build\bdist.win32\egg\coderev\web_ui.py", 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 11 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 11 years ago by anonymous

I have some error.

comment:3 Changed 11 years ago by achernov@…

I have some error.

comment:4 Changed 10 years ago by Scott

Cc: Scott added; anonymous removed

comment:5 Changed 10 years ago by Scott

This patch worked for me:

*** codereviewerplugin/0.12/coderev/web_ui.py   Thu Jun 28 10:55:36 2012
--- codereviewerplugin/0.12/coderev/web_ui.py   Wed Feb 19 08:30:06 2014
***************
*** 121,130 ****
              summary['_ref'] += '/' + review.repo
          comment += " for [%(_ref)s]:\n\n%(summary)s" % summary
          
          # find and update tickets
+         # TODO: handle when there's no explicitly named repo
+         repo = RepositoryManager(self.env).get_repository(review.repo)
          changeset = repo.get_changeset(review.changeset)
          ticket_re = CommitTicketUpdater.ticket_re
          tickets = ticket_re.findall(changeset.message)
          
--- 121,135 ----
              summary['_ref'] += '/' + review.repo
          comment += " for [%(_ref)s]:\n\n%(summary)s" % summary
          
          # find and update tickets
+         rm = RepositoryManager(self.env)
+         new_path = req.args.get('new_path')
+         reponame = req.args.get('reponame')
+         if reponame:
+             repo = rm.get_repository(reponame)
+         else:
+             reponame, repo, new_path = rm.get_repository_by_path(new_path)
          changeset = repo.get_changeset(review.changeset)
          ticket_re = CommitTicketUpdater.ticket_re
          tickets = ticket_re.findall(changeset.message)
          
Version 2, edited 10 years ago by Ryan J Ollos (previous) (next) (diff)

comment:6 Changed 10 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 10 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 changeset.py: nullege.com

comment:8 Changed 10 years ago by Ryan J Ollos

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

comment:9 Changed 10 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 10 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to Scott

comment:11 Changed 10 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
Action
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.