Re: Loading Resources From a Python Module/Package
Barry Warsaw <[email protected]> Mon, 2 Feb 2015 16:53:03 -0500
| Newsgroups | gmane.comp.python.import |
|---|---|
| Organization | Damn Crazy Followers of the Horn |
| Message-ID | <[email protected]> |
On Jan 31, 2015, at 01:18 PM, Donald Stufft wrote: >I think it actually makes things *harder* from an implementation and >description standpoint. You’re thinking in terms of implementation for the >FileLoader, but say for a PostgreSQLLoader now I have to create mock packages >for warehouse.templates and warehouse.templates.accounts whereas if we treat >the resource path not as a file path, but as a key for an object store where >“/“ is slightly special then my PostgreSQL loader only need to have a >“warehouse” package, and then a table that essentially does something like: > > package | resource key | data > -------------------------------------------------- > warehouse | templates/accounts/profile.html | … > >In the FileLoader we’d obviously treat the / as path separators and create >directory entries, but in reality it’s just a key: value store. I already >implemented one of these functions in a way that allows the / separator and I >would have had to have gone out of my way to disallow it rather than allow >it. So that would mean the API is actually: resource_whatever(resource_anchor, resource_key) and loaders would be free to interpret resource_key however they want, including *not* supporting some resource_keys, e.g. throw an exception. Cheers, -Barry _______________________________________________ Import-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/import-sig
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUz/G/AAoJEBJutWOnSwa/9r8P/0z3jUlveAiXEiYv4WGueejO jEtnQaBmIGXQ3EaMFdTuOZ5mFVuApjFFpduhvhPqC0NcaLZAW19AquVTEH7KVNyc HTfJSOnSSc4Ch+HWr1lz8Zz/kkHcF1K4ClNySq6wxt0pzaa2AwjGjv8f0IZaufuI Dfb4klyq+jOBfVgm4Xr/jGugzRfUbsTgVNEIQXEqJS8Od/8+7xB2Z64b/pJ2WDyl Is66sRQHdF4JNsT9mfxXSHIc5ZsCOsbC1CzFgZ3x2gSW7XCwhSaA31JkK9kmBVvF LWAu1fploW8SNzPhSiVt39WjDT4uXoSvYiFfOS8qm9hqjdV+tXGh/RTQdjBuvuV6 xXHGdOmpRVzJDYfigSoN91ymjGzRk2s01NuNA8x6+gv+D5R/iTPJfJOutclr82aQ A3k9szrzBY/LC+cz1fUGfORct8OsSUC7Y7YRmKlpbluPDhyHKD8TB3Qi3Fi3dsv3 rW7XWQ7Rq2KOPKGlLHdS+yOUPAmphcpfTfJk8oTwDryyT1/WCA5ZQJog7cXoVq7K Jt6hb8GaacTMBDv0tt0/T2PH3r5kL4uU9+QVoiY2SgO4AEKxNeTofT05F0co6j5w t6IvixeTq+VV0LSqlm30rPbaBulafNvvMG0tFXQE3Tz3d5Rg5LNONI8IG5iSNfSq XdFOD6SYAbXA0Bu3h4aD =3233 -----END PGP SIGNATURE-----