Edgewall Software
Modify

Opened 10 years ago

Closed 9 years ago

Last modified 6 years ago

#480 closed defect (fixed)

Bitten & Trac 0.12 - "default repository" triage

Reported by: anonymous Owned by: osimons
Priority: blocker Milestone: 0.6
Component: Trac plugin Version: 0.6b2
Keywords: Cc: mpotter@…, sahendrickson@…
Operating System: Linux

Description

When trying to add a repository, autocompletion works for multirepos.

File "/usr/lib/python2.6/site-packages/Trac-0.12multirepos_r8662-py2.6.egg/trac/web/main.py", line 467, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.6/site-packages/Trac-0.12multirepos_r8662-py2.6.egg/trac/web/main.py", line 212, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.6/site-packages/Trac-0.12multirepos_r8662-py2.6.egg/trac/admin/web_ui.py", line 118, in process_request
  path_info)
File "/usr/lib/python2.6/site-packages/Bitten-0.7dev_r776-py2.6.egg/bitten/admin.py", line 195, in render_admin_panel
  config = self._create_config(req)
File "/usr/lib/python2.6/site-packages/Bitten-0.7dev_r776-py2.6.egg/bitten/admin.py", line 240, in _create_config
  warnings = self._update_config(req, config)
File "/usr/lib/python2.6/site-packages/Bitten-0.7dev_r776-py2.6.egg/bitten/admin.py", line 280, in _update_config
  node = repos.get_node(path, max_rev)

Attachments (5)

get_repository.patch (5.4 KB) - added by naxat88@… 9 years ago.
small hack to make integration with trac 0.12 work
get_repository.2.patch (6.5 KB) - added by naxat88@… 9 years ago.
hopefully I got the permission checks now right with the new API
t480-get_repository-r880.diff (5.7 KB) - added by osimons 9 years ago.
Simplified the get_repository call + removed one instance where it isn't actually used.
t480-get_repository-r880-2.patch (6.1 KB) - added by silk <silk@…> 9 years ago.
fix permission check in timeline provider
t480-default-repository_r881-trunk.patch (10.7 KB) - added by sahendrickson@… 9 years ago.
updated patch to inform user of need for creating a (default) repository

Download all attachments as: .zip

Change History (16)

comment:1 Changed 9 years ago by rverchere@…

Hi there,

get a similar issue with Trac 0.12dev-r9406 + Bitten 0.7dev-r815.

In trac 0.12dev, get_repository() takes 3 arguments :

def get_repository(self, reponame=None, authname=None):

But this as not been updated in bitten code (reponame is not present).

comment:2 Changed 9 years ago by victor

Hi,

Can you fix this defect?

when use multirepos, and create new Build Configuration, trac wrote:

Attribute Error?: 'None Type?' object has no attribute 'get_node'.

Trac 0.12dev-r9593 Bitten 0.7dev-r870 Subversion 1.6.11 (r934486) mod_python 3.3.2-dev-20080819

Changed 9 years ago by naxat88@…

small hack to make integration with trac 0.12 work

comment:3 Changed 9 years ago by naxat88@…

I've attached a small patch with which the integration with trac 0.12 seems to work. Unfortunately the authz-checks are ignored when using trac 0.12, since this part of the plugin-API has changed too.

Changed 9 years ago by naxat88@…

hopefully I got the permission checks now right with the new API

Changed 9 years ago by osimons

Simplified the get_repository call + removed one instance where it isn't actually used.

comment:4 Changed 9 years ago by osimons

  • Owner set to osimons

Thanks for the patch! Great work, and I've just simplified it slightly as the authname naming is unchanged from 0.11.0 we can just pass the name and it works for either regular argument or keyword argument. See attachment:t480-get_repository-r880.diff

I'm tempted to push this patch to both trunk (0.7) and 0.6. From unittests and my inital testing with various builds and views, it makes Bitten work with Trac 0.12 using a '0.11-style setup' (just a default subversion repository). Actually supporting multirepos and all the new Trac 0.12 features is still work for a future 0.7 version of Bitten.

Further testing needed? Comments?

Changed 9 years ago by silk <silk@…>

fix permission check in timeline provider

comment:5 Changed 9 years ago by silk <silk@…>

I attached an updated patch that fixes the timeline provider if repository has authz checks enabled.

+1 for commit to 0.6 and trunk

comment:6 Changed 9 years ago by osimons

  • Milestone changed from 0.6.1 to 0.6

Compared the patches, and from what I can see all that is changed is this:

  • (a) v1 vs. (b) v2

    a b  
    134136+                if not repos.authz.has_permission(path):
    135137+                    continue
    136138+            else:
    137 +                node = repos.get_node(config.path)
     139+                node = repos.get_node(path)
    138140+                if not node.can_view(req.perm):
    139141+                    continue
    140142+

Makes sense - Thanks!

comment:7 follow-up: Changed 9 years ago by osimons

Patch still has a fault in that it breaks if no default repository is present - basically self.env.get_repository() then returns None. This is now a much larger problem with new projects on 0.12 as that version not configure the "old way" anymore.

Ideas for how best to handle this is most welcome. Do we just disable Bitten and log an error for admin perhaps?

comment:8 Changed 9 years ago by Mark Potter <mpotter@…>

  • Cc mpotter@… added

comment:9 in reply to: ↑ 7 Changed 9 years ago by anonymous

Replying to osimons:

Patch still has a fault in that it breaks if no default repository is present - basically self.env.get_repository() then returns None. This is now a much larger problem with new projects on 0.12 as that version not configure the "old way" anymore.

Ideas for how best to handle this is most welcome. Do we just disable Bitten and log an error for admin perhaps?

comment:10 Changed 9 years ago by sahendrickson@…

  • Cc sahendrickson@… added
  • Priority changed from major to blocker
  • Summary changed from AttributeError: NoneType object has no attribute get_node to Bitten & Trac 0.12 - "default repository" triage

This latest patch thows an assertion error with an indication for the user to add a "(default)" repository if none exists in Trac 0.12.

In my opinion, this patch (or something similar) ought to be incorporated into a new release so that Bitten no longer breaks when installed in the current version of Trac.

Of course, a longer term solution still needs to be addressed (as mentioned in #433 and #342).

Changed 9 years ago by sahendrickson@…

updated patch to inform user of need for creating a (default) repository

comment:11 Changed 9 years ago by osimons

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

Thanks a lot for the updated patch. It includes a lot more assert statements than I had hoped, but as they are all placed right after accessing env.get_repository() they will no doubt be picked up when we rework repository access for full 0.12 support.

I've gone through the last patch and trimmed lines to 80 chars max, tweaked tests and added a new test, and also changed the master to pass this error back to the slave as well (at least for the common 'populate' use-case).

Patch is committed in [882] (trunk) and [883] (0.6 branch).

Add Comment

Modify Ticket

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