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

API improvements #186

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
07fe3f0
Correct the EUID error message
peternewman Apr 3, 2018
af75bb5
First version of v2 API changes
peternewman Apr 14, 2018
ae63973
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Apr 14, 2018
23354d7
Fix some flake8 issues
peternewman Apr 14, 2018
2739516
Fix the JS lint issue
peternewman Apr 14, 2018
583051f
Fix the JS unit test
peternewman Apr 14, 2018
fc8a0f5
Merge branch 'master' into plugfest
peternewman Apr 17, 2018
c69a6e1
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Apr 23, 2018
9e5afb4
Merge branch 'plugfest' of https://github.com/peternewman/rdm-app int…
peternewman Apr 23, 2018
dfaad2e
Merge branch 'master' into plugfest
peternewman May 12, 2018
884523e
Merge branch 'master' into plugfest
peternewman Jul 6, 2018
c3f0724
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Jul 9, 2018
924665d
Merge branch 'plugfest' of https://github.com/peternewman/rdm-app int…
peternewman Jul 9, 2018
f2dc076
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Jul 30, 2018
a66cefc
Merge branch 'master' into plugfest
peternewman Jul 31, 2018
ac3e730
Update the name of a PID where necessary, also save a PID even if doe…
peternewman Oct 29, 2018
b52a72e
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Oct 29, 2018
8331910
Merge branch 'plugfest' of https://github.com/peternewman/rdm-app int…
peternewman Oct 29, 2018
a54e598
Fix the manufacturer link add/update reporting
peternewman Oct 30, 2018
b1259e4
Add DMX4All URL
peternewman Nov 27, 2018
e8e5188
Add LTECH URL
peternewman Nov 27, 2018
5365b4f
Merge branch 'master' into plugfest
peternewman Nov 27, 2018
f8cfce5
Add NXP
peternewman Dec 10, 2018
e6b6734
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Dec 11, 2018
d2afb38
Merge branch 'plugfest' of https://github.com/peternewman/rdm-app int…
peternewman Dec 11, 2018
4896620
Update the ESTA TSP links
peternewman Dec 11, 2018
125680c
Add another ESTA URL and switch them all to HTTPS
peternewman Dec 11, 2018
4405a32
Merge branch 'master' into plugfest
peternewman Jan 16, 2019
d34a7aa
Merge branch 'master' into plugfest
peternewman Sep 21, 2019
abe69d7
Merge branch 'master' of https://github.com/openlightingproject/rdm-a…
peternewman Feb 25, 2020
f294d33
Merge branch 'plugfest' of https://github.com/peternewman/rdm-app int…
peternewman Feb 25, 2020
e7fb760
Merge branch 'master' into plugfest
peternewman Oct 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 25 additions & 3 deletions admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,19 @@ def UpdateManufacturers(self):
manufacturers_to_delete = []
# invalidate the cache now
memcache.delete(memcache_keys.MANUFACTURER_CACHE_KEY)
memcache.delete(memcache_keys.MANUFACTURER_MODEL_COUNTS)
memcache.delete(memcache_keys.MANUFACTURER_CACHE_KEY_2)
# This is linked to manufacturer PIDs, so invalidate
memcache.delete(memcache_keys.MANUFACTURER_PID_COUNT_KEY)
# These need invalidating as they display manufacturer names
memcache.delete(memcache_keys.MANUFACTURER_MODEL_COUNTS)
memcache.delete(memcache_keys.MANUFACTURER_CONTROLLER_COUNTS)
memcache.delete(memcache_keys.MANUFACTURER_NODE_COUNTS)
memcache.delete(memcache_keys.MANUFACTURER_SOFTWARE_COUNTS)
memcache.delete(memcache_keys.MANUFACTURER_SPLITTER_COUNTS)
memcache.delete(memcache_keys.MANUFACTURER_CONTROLLER_COUNTS_2)
memcache.delete(memcache_keys.MANUFACTURER_NODE_COUNTS_2)
memcache.delete(memcache_keys.MANUFACTURER_SOFTWARE_COUNTS_2)
memcache.delete(memcache_keys.MANUFACTURER_SPLITTER_COUNTS_2)
added = removed = updated = errors = 0

for manufacturer in Manufacturer.all():
Expand Down Expand Up @@ -147,13 +158,20 @@ def UpdateManufacturers(self):

def UpdateManufacturerLinks(self):
# TODO(Peter): Add ability to remove links if not present in data?
# TODO(Peter): Only clear caches if we've done something
new_data = {}
for id, name in MANUFACTURER_LINKS:
new_data[id] = name

present_manufacturers = set()
# invalidate the cache now
memcache.delete(memcache_keys.MANUFACTURER_CACHE_KEY)
memcache.delete(memcache_keys.MANUFACTURER_CACHE_KEY_2)
# These need invalidating as they display manufacturer links
memcache.delete(memcache_keys.MANUFACTURER_CONTROLLER_COUNTS_2)
memcache.delete(memcache_keys.MANUFACTURER_NODE_COUNTS_2)
memcache.delete(memcache_keys.MANUFACTURER_SOFTWARE_COUNTS_2)
memcache.delete(memcache_keys.MANUFACTURER_SPLITTER_COUNTS_2)
added = updated = missing = errors = 0

for manufacturer in Manufacturer.all():
Expand All @@ -164,8 +182,6 @@ def UpdateManufacturerLinks(self):
if not(manufacturer.link) or (new_link != manufacturer.link):
try:
# add/update if required
manufacturer.link = new_link
manufacturer.put()
if manufacturer.link:
logging.info('Updating link for %d (%s) %s -> %s' %
(id, manufacturer.name, manufacturer.link, new_link))
Expand All @@ -174,6 +190,8 @@ def UpdateManufacturerLinks(self):
logging.info('Adding link for %d (%s) - %s' %
(id, manufacturer.name, new_link))
added += 1
manufacturer.link = new_link
manufacturer.put()
except BadValueError as e:
logging.error('Failed to add link for 0x%hx (%s) - %s: %s' %
(id, manufacturer.name, new_link, e))
Expand Down Expand Up @@ -455,6 +473,7 @@ def UpdateControllers(self):
CONTROLLER_DATA,
Controller,
[memcache_keys.MANUFACTURER_CONTROLLER_COUNTS,
memcache_keys.MANUFACTURER_CONTROLLER_COUNTS_2,
memcache_keys.TAG_CONTROLLER_COUNTS],
timestamp_keys.CONTROLLERS)

Expand All @@ -466,6 +485,7 @@ def UpdateNodes(self):
NODE_DATA,
Node,
[memcache_keys.MANUFACTURER_NODE_COUNTS,
memcache_keys.MANUFACTURER_NODE_COUNTS_2,
memcache_keys.TAG_NODE_COUNTS],
timestamp_keys.NODES)

Expand All @@ -477,6 +497,7 @@ def UpdateSplitters(self):
SPLITTER_DATA,
Splitter,
[memcache_keys.MANUFACTURER_SPLITTER_COUNTS,
memcache_keys.MANUFACTURER_SPLITTER_COUNTS_2,
memcache_keys.TAG_SPLITTER_COUNTS],
timestamp_keys.SPLITTERS)

Expand All @@ -488,6 +509,7 @@ def UpdateSoftware(self):
SOFTWARE_DATA,
Software,
[memcache_keys.MANUFACTURER_SOFTWARE_COUNTS,
memcache_keys.MANUFACTURER_SOFTWARE_COUNTS_2,
memcache_keys.TAG_SOFTWARE_COUNTS],
timestamp_keys.SOFTWARE)

Expand Down