Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Remove hardcoded table names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kit Cambridge committed Apr 6, 2015
1 parent 05c4828 commit ecc968f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions autopush/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def save_notification(self, uaid, chid, version):
try:
cond = "attribute_not_exists(version) or version < :ver"
conn.put_item(
"storage",
self.table.table_name,
item={
"uaid": {'S': uaid},
"chid": {'S': chid},
Expand Down Expand Up @@ -118,7 +118,6 @@ def delete_notification(self, uaid, chid, version=None):
# Proprietary Ping storage info
# Tempted to put this in own class.

tableName = "router"
ping_label = "proprietary_ping"
type_label = "ping_type"
modf_label = "modified"
Expand All @@ -131,7 +130,7 @@ def register_connect(self, uaid, connect):
if cinfo.get("type") is None:
return False
self.table.connection.update_item(
self.tableName,
self.table.table_name,
key={"uaid": {'S': uaid}},
attribute_updates={
self.ping_label: {"Action": "PUT",
Expand All @@ -158,7 +157,7 @@ def get_connection(self, uaid):
def unregister_connect(self, uaid):
try:
self.table.connection.update_item(
self.tableName,
self.table.table_name,
key={"uaid": {'S': uaid}},
attribute_updates={
self.ping_label: {"Action": "DELETE"},
Expand Down Expand Up @@ -192,7 +191,7 @@ def register_user(self, uaid, node_id, connected_at):
try:
cond = "attribute_not_exists(node_id) or (connected_at < :conn)"
conn.put_item(
"router",
self.table.table_name,
item={
"uaid": {'S': uaid},
"node_id": {'S': node_id},
Expand All @@ -216,7 +215,7 @@ def clear_node(self, item):
try:
cond = "(node_id = :node) and (connected_at = :conn)"
conn.put_item(
"router",
self.table.table_name,
item={
"uaid": {'S': item["uaid"]},
"connected_at": {'N': str(item["connected_at"])}
Expand Down

0 comments on commit ecc968f

Please sign in to comment.