Closed Bug 1501346 Opened 6 years ago Closed 6 years ago

tweak api to support modelname + "API"

Categories

(Socorro :: Webapp, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Assigned: willkg)

Details

Attachments

(1 file)

The API code looks up class names in modules when models are requested. The problem with this is that it makes some generic names unusable by other things which I'd prefer they were used by. For example, "Products" is a SocorroMiddleware and corresponds to the /api/Products endpoint. This is in the webapp-django/crashstats/crashstats/models.py file. It prevents me from creating a Django model also titled "Products" for holding the data that we're moving over from alembic/sqlalchemy land. I have a similar problem with "ProductVersions". I don't really want to rewrite the API code. As a short-term solution, I want to tweak it to support looking up models by getattr(module, model) and also getattr(module, model + 'Middleware'). Then we can rename Products and ProductVersions to ProductsMiddleware and ProductVersionsMiddleware respectively. This bug covers that work.
Assignee: nobody → willkg
Status: NEW → ASSIGNED
Commits pushed to master at https://github.com/mozilla-services/socorro https://github.com/mozilla-services/socorro/commit/0e78f3f984388cfc5b21d462c034d91cd0210656 fix bug 1501346: fix api use of classnames This fixes the API code so that it can use model_name and model_name + "Middleware" when looking up models for handling. This allows us more leeway when naming middleware api classes. https://github.com/mozilla-services/socorro/commit/598f5a3b095aa2b54f22cc4b38b401bacdea26e0 Merge pull request #4657 from willkg/1501346-api-names fix bug 1501346: fix api use of classnames
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: