reddit/reddit — Issue #279: Adding a user as a moderator via API after removing them via the API causes 500 error
Author: bboe
Created: 2011-12-09 23:45:44+00:00
State: open

On my up-to-date local instance I am doing the following (I verified the error occurs on reddit too):

First removing a moderator:

URL: http://reddit.local:8000/api/unfriend/
POST Params

```python
{'type': 'moderator', 'api_type': 'json', 'container': u't5_d', 'name': 'pyapitestuser3', 'uh': u'PyAPITestUser2'}
```
Second adding a moderator:

URL: http://reddit.local:8000/api/friend/
POST Params

```python
{'type': 'moderator', 'api_type': 'json', 'container': u't5_d', 'name': 'pyapitestuser3', 'uh': u'PyAPITestUser2'}
```

This results in the following error (note that it still results in the user being made a moderator).

```
File './r2/controllers/validator/validator.py', line 170 in newfn
simple_vals, param_vals, *a, **kw)
File './r2/controllers/validator/validator.py', line 218 in validatedForm
val = self_method(self, form, responder, *a, **kw)
File './r2/controllers/api.py', line 538 in POST_friend
user_row = cls().user_row(friend)
File './r2/lib/pages/pages.py', line 2420 in user_row
if self.editable_fn and not self.editable_fn(user):
File './r2/lib/pages/pages.py', line 2739 in editable_fn
return c.site.can_demod(c.user, user)
File './r2/models/subreddit.py', line 282 in can_demod
return bully_rel._date <= victim_rel._date
AttributeError: 'bool' object has no attribute '_date'
```

I also should note, that when submitting from the web no such 500 error occurs.