Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Remove support for direct use of user_accont from publish_account_met…
Browse files Browse the repository at this point in the history
…ric (first argument is now the user account key).
  • Loading branch information
hodgestar committed Dec 20, 2012
1 parent 1c362bd commit d038103
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go/apps/jsbox/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MetricsResource(SandboxResource):

def _publish_event(self, api, ev):
conversation = self.app_worker.conversation_for_api(api)
self.app_worker.publish_account_metric(conversation.user_account,
self.app_worker.publish_account_metric(conversation.user_account.key,
ev.store, ev.metric, ev.value,
ev.agg)

Expand Down
2 changes: 1 addition & 1 deletion go/apps/jsbox/tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def check_reply(self, reply, cmd, success):

def check_publish(self, store, metric, value, agg):
self.app_worker.publish_account_metric.assert_called_once_with(
self.conversation.user_account, store, metric, value, agg)
self.conversation.user_account.key, store, metric, value, agg)

def check_not_published(self):
self.assertFalse(self.app_worker.publish_account_metric.called)
Expand Down
9 changes: 2 additions & 7 deletions go/vumitools/app_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,9 @@ def publish_conversation_metric(self, conversation, name, value, agg=None):
conversation.user_account.key, conversation.key, name)
self.publish_metric(name, value, agg)

def publish_account_metric(self, user_account, store, name, value,
def publish_account_metric(self, user_account_key, store, name, value,
agg=None):
if isinstance(user_account, basestring):
user_account_key = user_account
else:
user_account_key = user_account.key
name = "%s.%s.%s" % (
user_account_key, store, name)
name = "%s.%s.%s" % (user_account_key, store, name)
self.publish_metric(name, value, agg)

@inlineCallbacks
Expand Down

0 comments on commit d038103

Please sign in to comment.