praw-dev / praw

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

Home Page:http://praw.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rules.mod.reorder no longer working

NathanTech7713 opened this issue · comments

Describe the Bug

Attempting to reorder the rules of a subreddit tracebacks because the response is returning None.

Desired Result

It looks as though this line should return an iterative function:
response = self.subreddit_rules._reddit.post(API_PATH["reorder_subreddit_rules"], data=data)I've tried commenting out the lines that traceback to just see what response is, and response=None

Relevant Logs

File "C:\python332\lib\site-packages\praw\models\reddit\rules.py", line 448, in reorder
    for rule in response:
TypeError: 'NoneType' object is not iterable
>>>

Code to reproduce the bug

subreddit = reddit.subreddit("test")
rules = list(subreddit.rules)
# reorder them in any means you like, my preferred is:
new = [rules[1], rules[0], rules[2]]
subreddit.rules.mod.reorder(new)

My code example does not include the Reddit() initialization to prevent credential leakage.

Yes

This code has previously worked as intended.

No

Operating System/Environment

windows

Python Version

3.8

PRAW Version

7.6.0

Prawcore Version

2.3.0

Anything else?

No response

This issue is stale because it has been open for 20 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

Is this issue still occurring?

Hello.
Yes, this is still occurring.
Thanks.

This issue is stale because it has been open for 20 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

@LilSpazJoekp commenting because the bot wants to make this issue stale, not sure if there is more you need from me?

Not at the moment no. I'll let you know if I need anything else!

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 30 days.

I looked into this. I was only able to reproduce when the new list did not contain all the rules or had extra rules. Reddit must have changed how they validate rules and now doesn't return error data when an invalid order is used.

This issue is stale because it has been open for 30 days with no activity.

Remove the Stale label or comment or this will be closed in 30 days.

This issue is stale because it has been open for 30 days with no activity.

Remove the Stale label or comment or this will be closed in 30 days.

This issue was closed because it has been stale for 30 days with no activity.

I have found the source of this issue.
If a rule's short reason contains commas, it breaks the validity when it reorders.

I redid my rules without commas, and it reordered perfectly.

Thanks for the follow up.