search5 / solrpy

Automatically exported from code.google.com/p/solrpy
Other
40 stars 17 forks source link

python2 and 3 compatible work complete #43

Closed search5 closed 6 years ago

search5 commented 8 years ago

Through a small code change has been modified so that all solrpy compatible operation with python 2 and 3.

edsu commented 8 years ago

@search5 thanks for this. @lexpar do you want to give this a try and see if it works in your python3 environment? I think this pull request is preferable to https://github.com/edsu/solrpy/pull/41 because it doesn't involve having duplicate codebases for python 2 and 3.

edsu commented 8 years ago

@search5 Was there a reason why you used both the future module and six instead of just six?

edsu commented 8 years ago

When I run the tests on python v3.5.1 and solr v4.10.3 I get 126 errors :-)

Many of them look like this:

ERROR: test_update_single (test_all.TestUpdatingDocuments)
Try to add one document, and then update it (readd it)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ed/Projects/solrpy/tests/test_all.py", line 446, in test_update_single
    self.add(**doc)
  File "/Users/ed/Projects/solrpy/tests/test_all.py", line 67, in add
    self._connections[-1].add(**doc)
  File "/Users/ed/Projects/solrpy/solr/core.py", line 687, in add
    return Solr.add_many(self, [fields], commit=_commit)
  File "/Users/ed/Projects/solrpy/solr/core.py", line 335, in wrapper
    return self._update(content, query)
  File "/Users/ed/Projects/solrpy/solr/core.py", line 569, in _update
    if starts('<result status="') and not starts('<result status="0"'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Do you not see that?

agpar commented 8 years ago

I get 160 errors as well. It looks like the tests have not been updated to be python 3 compatible.

Then again, most of the errors seem to be in the usage of the urlparse module in core.py

edsu commented 8 years ago

I'm sorry but this approach really isn't viable because of the code duplication.

edsu commented 8 years ago

Oops, sorry. I confused this with #41.

search5 commented 6 years ago

I reworked it with # 50 issues.