Modify

Opened 6 years ago

Last modified 6 years ago

#3521 reopened defect

Internal Error when logged out

Reported by: cgaert@… Owned by: tsooboi
Priority: normal Component: NavControlPlugin
Severity: minor Keywords:
Cc: Trac Release: 0.11

Description

When I have the NavControlPlugin enabled and am not logged in I get this error on every page I try to load:

Trac detected an internal error: KeyError: 'mainnav'

That's another message on the error page (here I tried to load the login page):

The action that triggered the error was: GET: /login

I don't have the problem when I'm logged in. I use the AccountManagerPlugin with HtPasswdStore. Because I can't load the login page I can't login hence can't use Trac.

Attachments (0)

Change History (6)

comment:1 in reply to: ↑ description Changed 6 years ago by tsooboi

  • Status changed from new to assigned

Replying to cgaert@gmx.de:

Can you provide your configuration setup and permissions for anonymous? I have this setup and it works without any problems when I'm either logged in or logged out. I also use the AccountManagerPlugin with HtPasswdStore.

Thanks

comment:2 follow-up: Changed 6 years ago by cgaert

anonymous hasn't any permissions because it's a private Trac installation.

comment:3 in reply to: ↑ 2 Changed 6 years ago by tsooboi

  • Priority changed from high to low
  • Resolution set to invalid
  • Severity changed from blocker to trivial
  • Status changed from assigned to closed

I tried this. I removed all permissions for anonymous in my private setup and disabled my plugin and got the same error.

This has nothing to do with my plugin.

You should enable WIKI_VIEW permission for anonymous to your trac setup.

  • trac-admin in interactive mode
    trac-admin /path/to/your/private/trac
    
  • !add the permission as follows:
    permission add anonymous WIKI_VIEW
    

This should enable you to go to the login page.

Again, it has nothing to do with the plugin. Thanks

comment:4 Changed 6 years ago by tsooboi

  • Priority changed from low to normal
  • Resolution invalid deleted
  • Severity changed from trivial to minor
  • Status changed from closed to reopened

Reopened because after further testing.

A quick fix will be to enable WIKI_VIEW for anonymous but I will take a look to see if there are other ways.

Thanks

comment:5 Changed 6 years ago by cgaert

Thanks, this helps.

I use the PrivateWikiPlugin and set WikiStart as private. Now I can give WIKI_VIEW permissions to anonymous. With these settings anonymous will not be able to see the Wiki but the login page. Now everything works as I expected.

comment:6 Changed 6 years ago by pedro

if you change your post_process_request to

def post_process_request(self, req, template, data, content_type):
        if req.authname == 'anonymous':
            return template, data, content_type
        self._remove_items(req, 'mainnav')
        self._remove_items(req, 'metanav')    
        self._move_items(req, 'main2meta')
        self._move_items(req, 'meta2main')
        self._relabel_items(req)
        return template, data, content_type

then the WIKI_VIEW permissions are not needed to login if you're using the AccountManagerPlugin. I also use the PermRedirectPlugin to redirect all permission errors to the login page.

Add Comment

Modify Ticket

Action
as reopened The owner will remain tsooboi.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.