37 Commits

Author SHA1 Message Date
Simen Heggestøyl
2ad4630c03 Port batchaddmedia command to Python 3 2017-10-16 18:25:40 +03:00
Simen Heggestøyl
4727ee109e Handle collection in batchaddmedia command
Make the batchaddmedia command look for a 'collection-slug' column, that
for each row may specify the slug of a collection that the media should
be added to. This matches the '--collection-slug' argument of the
addmedia command.
2017-10-16 18:22:30 +03:00
Simen Heggestøyl
ceab88e3bd Remove dead code in batchaddmedia.py
Remove an unused import and an unused local variable from
batchaddmedia.py.
2017-10-16 18:20:30 +03:00
Loic Dachary
6c0678576a Fix #928 - cleanup to avoid duplicated get_upload_file_limits
Signed-off-by: Loic Dachary <loic@dachary.org>
2016-07-25 03:48:33 +03:00
Jessica Tallon
0f3bf8d4b1 Collection changes and migration for federation
- Adds a "type" column to the Collection object and allows the
CollectionItem model to contain any object.
- Changes "items" to "num_items" as per TODO
- Renames "uploader", "creator" and "user" to a common "actor" in most places
2015-10-07 14:40:44 +02:00
Jessica Tallon
b4997540dc Fix some unit tests and bugs
This fixes a lot of the issues with the LocalUser changes that were
merged recently. There was a problem where the attributes of LocalUser
were not being eagerly loaded and because the Session was detached an
exception was being raised when they were accessed.

This also fixes some typo's which were introduced.

Finally this adds a temporary fix for a potential SQLAlchemy bug, this
is a bug where doing:

    User.query.filter(LocalUser.username == "some_username").first()

does NOT yeild a user with the username "some_username" but all users
on the site. The temp fix is to just query the LocalUser, this should
be resolved when bug is confirmed and fixed upstream.
2015-08-24 21:07:06 +02:00
Jessica Tallon
d88fcb03e2 Change codebase to query or create correct User model
The code base had many references to User.username and other
specific to LocalUser attributes as that was the way it use to exist.
This updates those to query on the generic User model but filtering
by attributes on the LocalUser.
2015-07-31 15:15:24 +02:00
Berker Peksag
896d00fbf2 Change all unicode() calls with six.text_type().
Fixes #5329.
2015-06-25 22:24:03 +03:00
Berker Peksag
b36c84e68a Port "gmg batchaddmedia" command to Python 3. 2014-10-02 20:18:29 +03:00
Natalie Foust-Pilcher
446cece470 Used the codecs library to read the csv file in batchaddmedia as unicode. 2014-06-21 15:26:23 -04:00
tilly-Q
65f5714118 Adjusted batchaddmedia to make use of more internal nodes. Added to the docs. 2014-05-13 18:24:26 -04:00
tilly-Q
80fefb8514 Removed unused imports. 2014-05-13 16:59:02 -04:00
tilly-Q
c0ea2bad04 Prepared for input without an 'id' column and made all of the internal nodes
into free floating nodes so that compact_and_validate will remove them.
2014-05-13 16:57:12 -04:00
tilly-Q
8524a6bdc5 Added documentation for the batchaddmedia gmg tool to the mediagoblin docs. 2014-05-12 17:02:31 -04:00
tilly-Q
7d52eb7705 Modified the batchaddmedia script so that it only looks for one csv file instead
of the previous method which looked for two files.
2014-05-12 14:10:29 -04:00
tilly-Q
e8d64d453b Cleaned up the 'batchaddmedia' command a bit 2014-05-12 13:19:03 -04:00
Christopher Allan Webber
6fab7734d6 Updating batchaddmedia to use new metadata tools 2014-05-07 18:50:48 -05:00
Christopher Allan Webber
a448628636 Removing unused variables 2014-05-07 15:21:58 -05:00
Christopher Allan Webber
2a2c534e51 Removing build_json_ld_metadata 2014-05-07 15:21:10 -05:00
Christopher Allan Webber
af3a9107a9 The URL format checker now works correctly
...though it isn't checking the right thing
2014-05-07 13:39:03 -05:00
tilly-Q
9f5d388ec0 In the middle of some major changes 2014-04-21 19:07:28 -04:00
tilly-Q
7ff99dabfb Fixed a problem that was causing errors in batch uploading remote files. 2014-04-21 12:29:00 -04:00
tilly-Q
e00ce53ef6 I had imported requests twice 2014-04-21 12:18:29 -04:00
tilly-Q
45f426ddee Made it possible to submit media with the metadata provided 2014-04-21 12:11:12 -04:00
tilly-Q
ecea4847e8 Added the 'requests' library as a dependency and switched over to using it to
fetch remote pieces of media in the batchupload script
2014-04-21 12:11:11 -04:00
tilly-Q
18a9c50db6 Fixed incorrectly coded references to filesystem paths 2014-04-21 12:10:20 -04:00
tilly-Q
77d51d4f33 Fixed a bad get of 'dcterms:rights' and am throwing away the idea of an external
context file for the json-ld because it feels unnecessary seeing as we are just
using the dc core terms
2014-04-21 12:10:20 -04:00
tilly-Q
907d9626e3 Wrote more comprehensive error messages. 2014-04-21 12:10:19 -04:00
tilly-Q
e46760d315 Fixed a minor error in the batch upload script and modified the json-ld context. 2014-04-21 12:10:19 -04:00
tilly-Q
8c7cccf6cc Fixed up some fatal errors. Is still not ready. 2014-04-21 12:10:19 -04:00
tilly-Q
26b3d6cf27 Added exception handling into the metadata format checking function. 2014-04-21 12:10:19 -04:00
tilly-Q
3e76b2bc77 Began work on metadata validation 2014-04-21 12:10:19 -04:00
tilly-Q
5c14f62d19 Changed some of the print messages as well as tweaked the order of
the commands attempts to figure out what type of file the target file
is.
2014-04-21 12:10:19 -04:00
tilly-Q
28ecc53a5a I made it so the command no longer requires the "Target type" to be provided,
it now recognizes whether the target is a directory or an archive on its own.

I added in a help message, which is still incomplete, but should make it easier
for admins to know how to use this new command. I believe we should also provi-
-de an example of the location.csv and metadata.csv files, so there is no conf-
-usion. Also, I made it possible for the command to recognize zip files as a
valid archive. I also made some minor changes to the commands description w/i
the larger gmg command help menu.
2014-04-21 12:10:19 -04:00
tilly-Q
6c37aeaa33 Minor change in the wording of argparsing. 2014-04-21 12:10:19 -04:00
tilly-Q
268f243074 The script now officially works! It works in many different situations, whether
the media is to be uploaded is stored locally or on the web. Still have to clean
up the code and look for errors. I may also refactor some of this into a functi-
on to be used with a GUI frontend in another project. Lastly, I need to merge
this with the metadata branch I've been working on, and convert the metadata.csv
information into the proper format for the new metadata column.
2014-04-21 12:10:18 -04:00
tilly-Q
8aa015978c This branch will create a commandline bulk-upload script. So far, I have written
the code to read csv files into a usable dictionary.
2014-04-21 12:10:18 -04:00