Browse Source

Fix Python3 compat

- Unicode support in Git hook
- Bad reduce usage
David Cramer 8 years ago
parent
commit
ab43b2d87e
2 changed files with 4 additions and 1 deletions
  1. 3 1
      config/hooks/pre-commit
  2. 1 0
      src/sentry/search/utils.py

+ 3 - 1
config/hooks/pre-commit

@@ -8,6 +8,8 @@ from glob import glob
 
 from sentry.lint.engine import check_files
 
+text_type = type(u'')
+
 
 # git usurbs your bin path for hooks and will always run system python
 if 'VIRTUAL_ENV' in os.environ:
@@ -24,7 +26,7 @@ def main():
     _, files_modified, _ = run(gitcmd)
 
     files_modified = [
-        f
+        text_type(f)
         for f in files_modified
         if os.path.exists(f)
     ]

+ 1 - 0
src/sentry/search/utils.py

@@ -6,6 +6,7 @@ from collections import defaultdict
 from datetime import datetime, timedelta
 from django.db.models import Q
 from django.utils import timezone
+from six.moves import reduce
 
 from sentry.constants import STATUS_CHOICES
 from sentry.models import EventUser, User