Modify

Opened 13 years ago

Closed 10 years ago

#10116 closed defect (wontfix)

SyntaxError in rules.py (ln: 222)

Reported by: Vemund Owned by: Rob Guttman
Priority: normal Component: DynamicFieldsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Trying to run setup but get syntax error on line 222 in rules.py

byte-compiling build/bdist.linux-i686/egg/dynfields/rules.py to rules.pyc
  File "build/bdist.linux-i686/egg/dynfields/rules.py", line 222
    return 'type' if groups1.intersection(groups2) else None
                   ^
SyntaxError: invalid syntax

Last checkin added

# group rule
rule_re = re.compile(r"%s.(?P<op>(show|hide))_if_group" % target)
match = rule_re.match(key)
if match:
    groups1 = set(opts[key].split('|'))
    groups2 = set(self._get_groups(req.authname))
    if match.groupdict()['op'] == 'hide':
        return 'type' if groups1.intersection(groups2) else None
    else:
        return None if groups1.intersection(groups2) else 'type'

This is line 222

return 'type' if groups1.intersection(groups2) else None

Attachments (0)

Change History (9)

comment:1 Changed 13 years ago by Rob Guttman

vemundha, that is a python 2.6+ construct. Are you running Trac on < python 2.6?

comment:2 Changed 13 years ago by Vemund

Using 2.4. So we maybe need to upgrade python then..

comment:3 in reply to:  2 Changed 13 years ago by Rob Guttman

Replying to vemundha:

Using 2.4. So we maybe need to upgrade python then..

Actually it's a 2.5 feature:

http://en.wikipedia.org/wiki/Conditional_operator#Python

If upgrading your python version is an option, that would be best. There may be other plugins that also presume at least a 2.5 version. (2.4 as you know is quite old.)

comment:4 Changed 13 years ago by Ryan J Ollos

Just thought I'd throw this out there since it's something I've encountered previously ... #9800 and Trac's source suggest a way to restrict the version of Python during plugin installation.

comment:5 in reply to:  1 ; Changed 13 years ago by Vemund

Replying to robguttman:

vemundha, that is a python 2.6+ construct. Are you running Trac on < python 2.6?

We're running 2.4. What is the latest DynamicFieldsPlugin version supporting this (or svn rev)? We currently run 1.2.1. But it don't work in IE. Works ok with Chrome, FF and Opera.

comment:6 in reply to:  5 ; Changed 13 years ago by Rob Guttman

Replying to vemundha:

What is the latest DynamicFieldsPlugin version supporting this (or svn rev)? We currently run 1.2.1. But it don't work in IE. Works ok with Chrome, FF and Opera.

Use the latest 0.11 branch (not the 0.12 branch).

I try to support all major browsers but I don't use and rarely get to test on IE. If you submit a detailed defect ticket with s specific IE issue, I will take a look.

Regarding the issue defined by this ticket, do you intend to upgrade your python to at least 2.5?

comment:7 in reply to:  6 Changed 13 years ago by Vemund

Replying to robguttman:

Regarding the issue defined by this ticket, do you intend to upgrade your python to at least 2.5?

No. We have to upgrade a lot of other egg 2.4 connections. So if it's possible to get the latest 0.11 branch working with 2.4 it would be great.

comment:8 Changed 12 years ago by Ryan J Ollos

You could just change the line to (untested),

return groups1.intersection(groups2) and 'type' or None

and similarly for the else body,

return groups1.intersection(groups2) and None or 'type'

comment:9 Changed 10 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

I won't be providing anything other than non-critical fixes for Trac < 1.0. Trac 1.0 requires Python 2.5 - 2.7.

Modify Ticket

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