Modify

Opened 19 months ago

Closed 6 months ago

Last modified 6 months ago

#10834 closed defect (fixed)

Internal Error when submitting a review

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

Description (last modified by rjollos)

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 17 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 15 months ago by anonymous

I have some error.

comment:3 Changed 15 months ago by achernov@…

I have some error.

comment:4 Changed 6 months ago by hackonteur

  • Cc scott.roland@… added

comment:5 Changed 6 months ago by hackonteur

This patch worked for me:

  • codereviewerplugin/0.12/coderev/web_ui.py

    diff --git a/codereviewerplugin/0.12/coderev/web_ui.py b/codereviewerplugin/0.12/coderev/web_ui.py
    index 5e22e11..e2de454 100644
    a b class CodeReviewerModule(Component): 
    122122        comment += " for [%(_ref)s]:\n\n%(summary)s" % summary 
    123123 
    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 6 months ago by rjollos (previous) (diff)

comment:6 follow-up: Changed 6 months ago by rjollos

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 6 months ago by hackonteur

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 6 months ago by rjollos

  • Owner changed from robguttman to rjollos
  • Status changed from new to accepted

comment:9 Changed 6 months ago by rjollos

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

In 13695:

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

comment:10 Changed 6 months ago by rjollos

  • Owner changed from rjollos to hackonteur

comment:11 Changed 6 months ago by rjollos

In 13696:

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

Add Comment

Modify Ticket

Action
as 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.