Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configmanized middleware #811

Closed

Conversation

peterbe
Copy link
Contributor

@peterbe peterbe commented Sep 4, 2012

lars, adrian r?

All the tests for the new middleware_app work and the test coverage is complete.

At this point, some tests of the implementations (e.g unittest/external/postgresq/) are breaking because I'm running a pg 9.1 and there's some problems with CITEXT and mobeta tables.

I chose to delete all the old socorro/middleware/* files that we don't use any more. I did this because with the recent (albeit small) changes to the implementations, they no longer work.

@@ -34,10 +34,20 @@ def __init__(self, *args, **kwargs):

"""
self.context = kwargs.get("config")
# copy for legacy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this section of code ought to change to use .../socorro/external/postgresql/connection_context.py If not now, then mark it with a TODO or file a bug for the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that change as part of my middleware cleanup, see https://bugzilla.mozilla.org/show_bug.cgi?id=778744

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twobraids I'd rather not mess with it now. This approach makes it so that both the old and new middleware can co-work at the same time. Right, @AdrianGaudebert

@twobraids
Copy link
Contributor

throughout this middleware refactoring, the logging has not been updated to the "new" style. Rather than fetching the logger from a magic global, we've put ia logging object in the config dictionary under the key "logger". For consistency, I'd like to see that form used in the middleware.

@twobraids
Copy link
Contributor

I also like to see some consistent naming applied to the middleware. In the other configmanized apps, the configman dict is called "config". In the middleware, it is called "context", let's make that consistent.

@@ -311,6 +318,10 @@ def get_frequency(self, **kwargs):

See socorro.lib.search_common.get_parameters() for all filters.
"""
# aliases
kwargs['from_date'] = kwargs.get('from')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we using 'get' here just to suppress the KeyError if the key is missing? If those keys are missing, is it really not a fatal error? This question may be more for adrian than for peterbe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that was added for backward compatibility and that ought to be removed. The search service accepts from and to as parameters where others services use from_date and to_date. There should be no fatal error if a parameter is missing here as first those are not mandatory parameters and second if it were it would be handled somewhere else (after parameters are filtered).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdrianGaudebert I think the problem is that it says "aliases" in the comment. But in fact, it's really important.

The documentation says "from" and "to" but the code really needs it to be "from_date" and "to_date". https://github.com/peterbe/socorro/blob/bb51fe28cffe1b0e0010f970040a31a2e12bf830/socorro/external/postgresql/base.py#L129

If anything, I should remove the comment # aliases and leave it as is.

@twobraids to answer your question. The code below expects from_date to be defined in kwargs. By using .get() I get either the from date or a None.

@adngdb
Copy link
Contributor

adngdb commented Sep 11, 2012

Is there a bug associated with this pull request?


class Bugs(PostgreSQLBase):
"""Implement the /bugs service with PostgreSQL. """
filters = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you move that out of the function? For a small class like Bugs that has only one method it works, but other classes like Crashes can't do that. Is it not better to keep it consistent?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok now I see why you did that. I find it really tricky but it seems to allow us to work around the POST params problem entirely. We will need clear documentation on that though, there's no chance anyone would figure it out without clear explanations imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it sucks. It's unfortunately the way the implementations work and I can't think of a better way to solve it.

@adngdb
Copy link
Contributor

adngdb commented Oct 4, 2012

So what are we blocked on here? I'd like to get that, at least, merged to master.

Is the revisions problem the only one blocking us now?

@peterbe
Copy link
Contributor Author

peterbe commented Oct 4, 2012

@AdrianGaudebert we're blocked on a r+ from @twobraids and you. :)

@twobraids
Copy link
Contributor

if it works then r+

@peterbe
Copy link
Contributor Author

peterbe commented Oct 8, 2012

74b1897

@peterbe peterbe closed this Oct 8, 2012
rhelmer pushed a commit to rhelmer/socorro that referenced this pull request Jul 30, 2013
…d-to-tiers

Add method to tiers for optgroups (bugs 882831, 882836)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants