get_filename_safe_course_id

24 views
Skip to first unread message

ji...@opencraft.com

unread,
Aug 5, 2016, 2:31:22 AM8/5/16
to General Open edX discussion
Hello,

I'm wondering whether it would be ok to move the edx-analytics-pipeline method opaque_key_util.get_filename_safe_course_id() into the edx-opaque-keys repository.

This method is currently also defined (identically) in edx-analytics-exporter.course_export, and we've got a PR in review for the edx-analytics-data-api that would also find it useful.

Does this sound ok?

Any preferences on where it should live in opaque_keys?

--

David Ormsbee

unread,
Aug 8, 2016, 11:40:24 AM8/8/16
to edx code
I could see adding something like this to a utils package in opaque keys, but it'd be nice if it worked across all key types instead of being course key specific.

Is it a requirement that the generated file names be human readable? Using base64.urlsafe_b64encode on the serialized key would give you something that's guaranteed to be robust and reversible -- in which case you might not need to add a new method at all.

Take care.

Dave

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/08b5861c-591d-412a-b1c3-9bb7ad4b4498%40googlegroups.com.

Jill Vogel

unread,
Aug 8, 2016, 1:23:31 PM8/8/16
to edx-...@googlegroups.com
Hi David,

Even if we use something external like urlsafe_b64encode, I would still rather have a shared library that returns the officially sanctioned opaque-key safe filenames.

I've started an opaque-keys PR, but it just copies the existing functionality and tests.

Should I update that PR to handle any OpaqueKey?

And would you like me to use base64.urlsafe_b64encode, or is it ok to use the existing alphanumeric logic?

Thanks!
--

Gabe Mulley

unread,
Aug 9, 2016, 8:37:49 AM8/9/16
to edx-...@googlegroups.com
I put this in slack as well, but we have at least one use case that require human-readable names.

Specifically: names of files in data packages exported to researchers.

We might be able to reconfigure things so that this is no longer necessary, but it would require some investigation to see how feasible that would be.

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
Reply all
Reply to author
Forward
0 new messages