View Single Post
Old 09-21-2020, 03:31 PM   #26
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by JimmXinu View Post
I've never done a template function before, so it's entirely possible I'm breaking rules for one or over-complicating it, but this is my version that can optionally return name or uuid for main, carda or cardb; defaulting to main and name.
The function breaks no rules that I know of. The most important rule is that the function is read-only vis-a-vis the database. Next is that the function doesn't try to keep static data. Yours doesn't break either of these.

The "not dm.is_device_present" doesn't prevent the bug where stale information is shown. The 'real' fix requires a change to gui2/device.py

What would someone do with the UUID in a template? In my original function I added it to the list, but after reflection I don't see use for it. And if you provide that, why not the path, the prefix, or the free space?
chaley is offline   Reply With Quote