Conversation
0296c61 to
6d9421d
Compare
Collaborator
Author
|
…t_list implementations All API resources previously used a 'wrapped(list)' subclass with __getslice__ to lazily fetch data from Cassandra when Tastypie applied pagination. In Python 3, __getslice__ is never called (replaced by __getitem__ with a slice object), causing all these endpoints to return empty results. Fix by implementing the logic directly in obj_get_list for each resource, returning a proper list. Also fix remaining Python 3 str/bytes issues: - sha1() in CreateBugResource and PackageVersionNewBuckets now uses .encode() - PackageVersionNewBuckets no longer converts str buckets to bytes unnecessarily - Remove unused measure_view import and commented-out dead code in ErrorsResource Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…hitecture Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
… Ubuntu RTM workaround Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…ted APIs - Rename MIDDLEWARE_CLASSES to MIDDLEWARE (Django 1.10+) - Simplify WSGI to standard Django get_wsgi_application(), removing oops-wsgi wrappers - Remove deprecated SESSION_SERIALIZER = PickleSerializer - Remove ADMIN_MEDIA_PREFIX (removed in Django 1.4) - Remove ADMINS/MANAGERS (unused) - Add WSGI_APPLICATION setting - Replace django.utils.http.urlquote with urllib.parse.quote - Use config.allow_bug_filing instead of settings.ALLOW_BUG_FILING Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
In Python 2, list slicing (obj[start:end]) called __getslice__(start, end). In Python 3 this method is never called, so all resources using the wrapped(list) pattern with __getslice__ returned empty results. Fix by implementing the logic directly in each obj_get_list(), returning proper lists that Tastypie's paginator can paginate normally. Also fix remaining Python 3 str/bytes issues: - sha1() now uses .encode() everywhere (CreateBugResource, PackageVersionNewBuckets) - Remove unnecessary isinstance/encode/decode dance in PackageVersionNewBuckets - Remove isinstance(column, str) byte-encoding guard in cassie.get_bucket_counts() - Remove unused measure_view import and dead commented-out code in ErrorsResource Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…m template - Guard vals and reports_state_fixed_master accesses against null/undefined - Remove the server-rendered 'means' variable from main.html (data comes from the API) - Pass no argument to mean_time_between_failures_graph() since means is fetched via API Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Contributor
Done. Since force-pushing isn't available, I used a revert commit to cleanly undo the WIP (and its earlier follow-up) and then re-applied everything as 6 logical commits on top:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modernizes the
errorsDjango application by cleaning up Python 2 legacy code, updating deprecated Django APIs, and fixing all API endpoints to work correctly under Python 3.Changes Made
Django modernization (
errors)MIDDLEWARE_CLASSES→MIDDLEWARE(Django 1.10+)wsgi.pyto standardget_wsgi_application(), removingoops-wsgiwrappersSESSION_SERIALIZER = PickleSerializer,ADMIN_MEDIA_PREFIX, and unusedADMINS/MANAGERSsettingsWSGI_APPLICATIONsettingdjango.utils.http.urlquotewithurllib.parse.quoteconfig.allow_bug_filinginstead ofsettings.ALLOW_BUG_FILINGAPI endpoint fixes (
errors/api/resources.py,errors/cassie.py)wrapped(list)pattern with__getslice__, which is never called in Python 3 — every endpoint was silently returning empty results. Each resource is now converted to a directobj_get_list()implementation returning a proper list.sha1(str)→sha1(str.encode())inCreateBugResourceandPackageVersionNewBucketsisinstance/encode/decode dance for bucket strings inPackageVersionNewBucketsisinstance(column, str)byte-encoding guard incassie.get_bucket_counts()measure_viewimport and dead commented-out code inErrorsResourceJavaScript / template fixes
valsandreports_state_fixed_masterin JS filesmeansvariable frommain.html(the JS fetches it from the API)Other fixes
launchpad.py: fixed indentation bug inpocket_for_binaries, removed Ubuntu RTM 14.09 workaroundsrc/retracer/config/Ubuntu 26.04/sources.list: added[trusted=yes]to ddebs entriesREADME.md/copilot-instructions.md: documentedpopulate-test-data.sh