Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple of tuple used for assigned_to #988

Closed
code-review-doctor opened this issue Jan 4, 2022 · 2 comments
Closed

Tuple of tuple used for assigned_to #988

code-review-doctor opened this issue Jan 4, 2022 · 2 comments
Labels
bug Something isn't working or is broken
Milestone

Comments

@code-review-doctor
Copy link
Contributor

Describe the bug
Tuple of tuples passed into assigned_to because unwanted comma on line 854:

if t.assigned_to and t.assigned_to.usersettings_helpdesk.email_on_ticket_change:
roles['assigned_to'] = ('closed_owner', context),

and as far as I can tell, assigned_to should instead be a tuple containing 2 items, but instead evaluates to:

(('closed_owner', context),)

The impact is expect error to happen when this code is hit:

template, context = roles[role]

The error will be ValueError: not enough values to unpack (expected 2, got 1)

Expected behaviour
Extra comma should be removed so it's just ('closed_owner', context).

Additional context
I am a static analysis bot that found this issue automatically (but my maintainer raised this ticket).

I can raise a PR to fix this for you

@code-review-doctor code-review-doctor added the bug Something isn't working or is broken label Jan 4, 2022
@timthelion
Copy link
Collaborator

I say the bot is probably right. I commit that code 09d8f8c#diff-206db4cdb6cf21b5ed528d9c5ebf6be95c221a1da93bbf1d2470521af208774eR740 and I'm sure I would never do something tricky like that on purpose, I'd always use the full parens for tupleization.

@gwasser gwasser added this to the 0.3.2 milestone Jan 4, 2022
gwasser added a commit that referenced this issue Jan 4, 2022
@gwasser
Copy link
Member

gwasser commented Jan 4, 2022

I removed the comma in a commit on stable, thanks @code-review-doctor

@gwasser gwasser closed this as completed Jan 4, 2022
@gwasser gwasser modified the milestones: 0.3.2, 0.3.3 Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or is broken
Projects
None yet
Development

No branches or pull requests

3 participants