-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
The `Redmine` class couldn't be pickled because the `gettatr` would attempt to turn any attribute access into a `Resource`, even `__getstate__`. The proposed fix treats attributes that begin with an underscore (and double-underscore) as non-`Resource` attributes and returns their value as-is. Fixes #64
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,13 @@ def __init__(self, url, **kwargs): | |
|
||
def __getattr__(self, resource): | ||
"""Returns either ResourceSet or Resource object depending on the method used on the ResourceManager""" | ||
return ResourceManager(self, resource) | ||
if resource.startswith('_'): | ||
try: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rconradharris
Author
Contributor
|
||
return self.__dict__[resource] | ||
except KeyError: | ||
raise AttributeError | ||
else: | ||
return ResourceManager(self, resource) | ||
|
||
def upload(self, filepath): | ||
"""Uploads file from filepath to Redmine and returns an assigned token""" | ||
|
Why not just
instead of try/catch block