Closed dakcarto closed 9 years ago
Not able to reproduce it. Drag and drop works fine here. The error seems a bit strange, because it is trying to look for a the mro attribute in a function, while that is something that should be an attribute of a class.
One solution we might try is to not decorate magic methods, which seems to be the cause of issues when pickling. What do you think of that?
If the decorator is causing problems, we can remove it temporarily, or i can try to use a different approach, like using a metaclass
On Wed, Mar 18, 2015 at 6:40 PM, Larry Shaffer notifications@github.com wrote:
Assigned #174 https://github.com/boundlessgeo/suite-qgis-plugin/issues/174 to @volaya https://github.com/volaya.
— Reply to this email directly or view it on GitHub https://github.com/boundlessgeo/suite-qgis-plugin/issues/174#event-258423638 .
Victor Olaya Software Engineer | Boundless http://boundlessgeo.com/ volaya@boundlessgeo.com @boundlessgeo http://twitter.com/boundlessgeo/
@volaya I was able to redo the 'retry' using functools
to ensure the function is not renamed, and I added a filter for magic names; but, I still get the pickle error.
from functools import wraps
from geoserver.catalog import Catalog
def retryMethodDecorator(func):
@wraps(func)
def decorator(*args, **kwargs):
try:
result = func(*args, **kwargs)
except Exception, e:
if "Errno 10053" in unicode(e):
result = func(*args, **kwargs)
else:
raise e
return result
return decorator
class RetryCatalog(Catalog):
def __getattribute__(self, attr_name):
obj = super(RetryCatalog, self).__getattribute__(attr_name)
if hasattr(obj, '__call__') and hasattr(obj, '__name__'):
if not obj.__name__.startswith('__'):
return retryMethodDecorator(obj)
return obj
I believe a meta class may be the way to go, because any decorator appears to cause the __mro__
issue.
I changed the approach and decorated the http connection instead. This seems to be working and not causing the pickle error
Indeed, it works.
When dragging GsTreeItem-inherited items, e.g. GeoServer layers/styles, the following error is thrown:
This appears to be related to the retry method decorator in a0eb5c3.