aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit/views.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix some unused imports and local variables.Ben Sturmfels2021-09-231-1/+1
|
* Remove remaining imports/calls to six not automatically removed by pyupgrade.Ben Sturmfels2021-03-051-2/+0
|
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-8/+8
|
* Fix #928 - cleanup to avoid duplicated get_upload_file_limitsLoic Dachary2016-07-251-1/+0
| | | | Signed-off-by: Loic Dachary <loic@dachary.org>
* Fix #5451 - add_message inconsistenciesAndrew Browning2016-04-021-6/+12
| | | | | Reformat add_message function calls for consistency and PEP8 line continuations.
* Add a comment when we do / don't add collections dropdownChristopher Allan Webber2016-01-071-0/+2
| | | | Otherwise that "del submit_form.collection" might be confusing :)
* Add collection drop down to submit page.tom2016-01-071-2/+20
|
* Fix add collection view for new schemaDaniel Krol2015-11-091-2/+4
|
* Add new hook for two-step media type checkingBoris Bobrov2015-02-161-13/+4
| | | | | | | | | | | | | | | | | Before uploaded media files were checked by extension. This led to situations when a plugin can support file with specific extension but doesn't due to lack of codecs, for example. Since the plugin reported that it supports uploaded file type, the upload was being declared successful, but transcoding failed. The failures were not easy to debug. The change adds a new hook that could allow two-step checking of the content. The result of the hook execution returns a tuple with media type name, manager and a callable sniffer, that can be used to perform probably expensive checks of the content. Also the change adds implementation of the hook for video.
* Use six.text_type instead of unicode().Berker Peksag2014-06-021-5/+7
| | | | I will be switch to use ``from __future__ import unicode_literals`` later.
* Pass in request.urlgen to submit_media so it can update the feed_url stuffChristopher Allan Webber2013-11-141-1/+2
| | | | This commit sponsored by Jesus Alberto Rodriguez Chavez. Thank you!
* Switching use of submit_media to be keyword arguments in views.py.Christopher Allan Webber2013-11-141-7/+8
| | | | | | | This should make things a bit easier for me to fiddle with argument ordering. This commit sponsored by Maira Sutton. Thanks!
* Breaking out get_upload_file_limits into its own utility.Christopher Allan Webber2013-11-141-10/+5
| | | | This commit sponsored by Mikael Nordfeldth. Thank you!
* Refactoring submission utility to make it more generic! Reusable!Christopher Allan Webber2013-11-131-92/+33
| | | | | This commit sponsored by Joar Wandborg. Joar, thanks for the many things you've done for MediaGoblin!
* Merge remote-tracking branch 'refs/remotes/tilly-q/OPW-Moderation-Update'Christopher Allan Webber2013-10-071-1/+2
|\ | | | | | | | | | | | | Conflicts: mediagoblin/templates/mediagoblin/user_pages/user.html mediagoblin/tests/test_auth.py mediagoblin/tests/test_submission.py
| * I did some more code-keeping in this commit. I added a lot of documentation, sotilly-Q2013-09-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that most of my functions do indeed have effective docstrings. I also changed the decorators so that they imply eachother in a logical way. I also modified the one decorator get_media_comment_by_id to be more usable with the variable urls of mediagoblin.user_pages.views:file_a_report. I also noticed a few tests had broken, so I went through them and fixed them up, finding that mostly there were problems in my actual writing of the tests. I also did a few other small tasks such as creating a new User method to check whether or not a User is ban- -ned. =============================================================================== Added in documentation =============================================================================== --\ mediagoblin/db/models.py --\ mediagoblin/decorators.py --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/user_pages/lib.py =============================================================================== Rearranged decorators to be more efficient =============================================================================== --\ mediagoblin/decorators.py --| Made it so that user_not_banned is encapsulated in require_active_login --| Made it so that require_active_login is encapsulated in user_has_privilege --| Changed get_media_comment_by_id into get_optional_media_comment_by_id. It | now returns valid code if the MediaComment id is absent. This makes it pos- | -sible to use this decorator for the function: | mediagoblin.user_pages.views:file_a_report --\ mediagoblin/user_pages/views.py --| Replaced the mediagoblin.user_pages.views:file_a_comment_report with the | decorator mentioned above --\ mediagoblin/user_pages/routing.py ----------------------------------------------------------- | took out unnecessary @user_not_banned decorators | ----------------------------------------------------------- --\ mediagoblin/submit/views.py --\ mediagoblin/user_pages/views.py =============================================================================== Fixed broken tests =============================================================================== --\ mediagoblin/tests/test_auth.py --\ mediagoblin/tests/test_privileges.py --\ mediagoblin/tests/test_submission.py =============================================================================== Fixed broken code =============================================================================== --\ mediagoblin/tools/response.py =============================================================================== Other Tasks =============================================================================== --\ mediagoblin/db/models.py --| Added in User.is_banned() method --\ mediagoblin/decorators.py --| Utitilized User.is_banned() method in the user_not_banned decorator --\ mediagoblin/moderation/views.py --| Made it impossible for an admin to ban themself. --| Got rid of a vestigial print statement --\ mediagoblin/templates/mediagoblin/base.html --| Made it so the top panel does not show up for users that are banned. --\ mediagoblin/templates/mediagoblin/moderation/user.html --| Rearranged the javascript slightly ===============================================================================
| * This is a quick commit. I gave admins the ability to ban or unban userstilly-Q2013-08-291-0/+1
| | | | | | | | | | | | | | | | | | straight from the moderation.users_detail page. I also changed the UserBan.expiration_date type from DateTime into Date. I also began work on the Terms of Service, pulled from another website (which will be cited clearly before I'm done). I added new tests as well for the ban/unbanning. Lastly, I added a few `user_not_banned` decorators to relevant views, so banned users cannot access any pages.
| * Merge branch 'master' into OPW-Moderation-Updatetilly-Q2013-08-201-1/+2
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/db/models.py mediagoblin/decorators.py mediagoblin/routing.py mediagoblin/user_pages/views.py
| * \ Merge branch 'ticket-679' into OPW-Moderation-Updatetilly-Q2013-07-291-4/+13
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/auth/tools.py mediagoblin/auth/views.py mediagoblin/db/migration_tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/decorators.py mediagoblin/user_pages/views.py
| * | | This was a simple commit. I changed all references to Groups into Privileges sotilly-Q2013-07-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as to not conflict with the new federated groups which are also being written. I also fixed up some of the code in the user_in_group/user_has_privilege decor- ator. Users are now assigned the default privileges when they sign up, and ass- iged active once they are activated. I updated the gmg command makeadmin to use my groups as well. Lastly, I added the decorator to various views, requiring th- at users belong to appropriate groups to access pages. --\ mediagoblin/auth/tools.py --| Added code to assign new users to default privileges --\ mediagoblin/auth/views.py --| Added code to assign users to u'active' privilege once the email | verification is complete --\ mediagoblin/db/migrations.py --| Renamed Group class to Privilege class --\ mediagoblin/db/models.py --| Renamed Group class to Privilege class --\ mediagoblin/decorators.py --| Renamed function based on the Group->Privilege change --| Rewrote the function to be, ya know, functional --\ mediagoblin/gmg_commands/users.py --| Changed the 'makeadmin' command to add the target user to the admin | privilege group as well as affecting 'is_admin' column --\ mediagoblin/submit/views.py --| Added the requirement that a user has the 'uploader' privilege in order | to submit new media. --\ mediagoblin/user_pages/views.py --| Added the requirement that a user has the 'commenter' privilege in order | to make a comment. --| Added the requirement that a user has the 'reporter' privilege in order | to submit new reports. --| Got rid of some vestigial code in the file_a_report function.
* | | | use media.get_uploader and fix typoRodney Ewing2013-08-261-1/+1
| | | |
* | | | javascript limit validationRodney Ewing2013-08-261-3/+8
| | | |
* | | | fix after rebaseRodney Ewing2013-08-261-2/+2
| | | |
* | | | max file sizeRodney Ewing2013-08-261-22/+30
| | | |
* | | | fixed tests and defaultsRodney Ewing2013-08-261-3/+1
| | | |
* | | | made no upload limit the defaultRodney Ewing2013-08-261-3/+3
| | | |
* | | | typosRodney Ewing2013-08-261-1/+1
| | | |
* | | | added testsRodney Ewing2013-08-261-7/+7
| | | |
* | | | added user upload limitsRodney Ewing2013-08-261-0/+34
| |_|/ |/| |
* | | Tweak Celery TaskSebastian Spaeth2013-08-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make sure Exceptions are pickleable (not sure if this was not the case but this is the pattern as documented in the celery docs. - Don't create a task_id in the GMG code, but save the one implicitely created by celery. - Don't create a task-id directory per upload. Just store queued uploads in a single directory (this is the most controversial change and might need discussion!!!) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | | Revert "Leave slug empty until we are sure media processing was successful."Rodney Ewing2013-08-081-0/+3
| | | | | | | | | | | | | | | | | | | | | This reverts commit f67611fb485b5a84cedc62b73beb1e551e8cb934. For some reason, generating a slug here throws an integrity error during a query when there is a duplicate slug.
* | | Leave slug empty until we are sure media processing was successful.Rodney Ewing2013-08-071-3/+0
| |/ |/| | | | | Patch submitted by LotusEcho
* | Patch by Strum. Ticket #451 - Convert all mongokit style .find, .find_one, ↵Rodney Ewing2013-07-111-3/+3
| | | | | | | | .one calls over to SQLAlchemy queries
* | fixes the inability to upload non ascii filenames, werkzeug strips all non ↵dunkyp2013-07-111-1/+6
| | | | | | | | | | | | ascii chars and returns an empty string. This checks if the filename contains non asciis and if it does generates a uuid for filename. Also the request version of filename is used for generating alternative title for upload cherry-picked from dunkyp. fixed conflicts and missing import.
* | New notificationsJoar Wandborg2013-06-091-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added request.notifications - Email configuration fixes - Set config_spec default SMTP port to `0` and switch to SSL/non-SSL default if `port == 0` - Added email_smtp_use_ssl configuration setting - Added migrations for notification tables - Added __repr__ to MediaComment(Mixin) - Added MediaComment.get_entry => MediaEntry - Added CommentSubscription, CommentNotification, Notification, ProcessingNotification tables - Added notifications.task to celery init - Fixed a bug in the video transcoder where pygst would hijack the --help argument. - Added notifications - views - silence - subscribe - routes - utility methods - celery task - Added half-hearted .active comment CSS style - Added quick JS to show header_dropdown - Added fragment template to show notifications in header_dropdown - Added fragment template to show subscribe/unsubscribe buttons on media/comment pages - Updated celery setup tests with notifications.task - Tried to fix test_misc tests that I broke - Added notification tests - Added and extended tests.tools fixtures - Integrated new notifications into media_home, media_post_comment views - Bumped SQLAlchemy dependency to >= 0.8.0 since we need polymorphic for the notifications to work
* Refactor submit util new_upload_entryElrond2013-05-211-4/+2
| | | | | | This tool creates an initial media entry for a given user. No magic. It just prefills the license with the user's default license and adds the user as uploader.
* Remove extra indentation left over from previous commit.Elrond2013-04-271-24/+24
| | | | | | | | This only removes an unneeded extra indentation, left over from the previous removal of code around. Extra commit so it is easy to check that it only changes indentation.
* Fix translations for collections and drop useless try.Elrond2013-04-271-7/+6
| | | | | | | | | | | | | | | | | | | Don't do: _("With some value: %s" % value) Please do: _("WIth some value: %s") % value Fixed for collection messages. Also removed a try: some_code. except Exception as e: raise No point in doing that. Fixing the indentation of some_code comes in an extra commit, because changing indentation is annoying enough alone, so don't mix it with other changes.
* Switching non-forms back to using normal pass_to_ugettextChristopher Allan Webber2013-04-241-1/+1
|
* Fix-bug-667-Use-lazy_pass_to_ugettext-for-forms.Aditi Mittal2013-04-241-1/+1
|
* Merge remote-tracking branch 'JDShu/649_use_form_data_field'Elrond2013-03-301-6/+6
|\ | | | | | | | | | | | | | | | | | | * JDShu/649_use_form_data_field: Use WTForms data field in user_pages/views.py Use WTForms data field in auth/views.py auth: whitespace cleanup in views.py Use WTForms data field in plugins/oauth/views.py Use WTForms data field in submit/views.py Use WTForms data field in edit/views.py
| * Use WTForms data field in submit/views.pyHans Lo2013-03-271-6/+6
| |
* | Refactor file field checking.Elrond2013-03-291-5/+3
|/ | | | | When uploading, the file field needs some checks, it seems. So refactor them into check_file_field and use around.
* user.get('moo') -> user.mooSebastian Spaeth2013-01-221-1/+1
| | | | | | | User fields are always existent, so there is no need to .get() them, just use them directly. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Merge remote-tracking branch 'refs/remotes/spaetz/521_license_preference' ↵Christopher Allan Webber2013-01-221-1/+2
|\ | | | | | | into mergetest
| * Add a license preference fieldMark Holmquist2013-01-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This feature is absolutely necessary. Now a user can simply define their default license and quickly go through a form, as opposed to stopping to click on the select and choosing the same option over and over again. Also added DB migration for the field, so that's working now, too. Rebased by Sebastian and made the default value to be unicode. Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Don't pass request into run_process_mediaSebastian Spaeth2013-01-151-1/+4
| | | | | | | | | | | | | | | | | | People(tm) want to start run_process_media from the CLI and might not have a request object handy. So pass in the feed_url into run_process_media rather than the request object and allow the feed url to be empty (resulting in no PuSH notification at all then). Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Make PuSHing the Pubhubsubbub server an async task (#436, #585)Sebastian Spaeth2013-01-151-6/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notifying the PuSH servers had 3 problems.  1) it was done immediately after sending of the processing task to celery. So if celery was run in a separate process we would notify the PuSH servers before the new media was processed/ visible. (#436) 2) Notification code was called in submit/views.py, so submitting via the API never resulted in notifications. (#585) 3) If Notifying the PuSH server failed, we would never retry. The solution was to make the PuSH notification an asynchronous subtask. This way: 1) it will only be called once async processing has finished, 2) it is in the main processing code path, so even API calls will result in notifications, and 3) We retry 3 times in case of failure before giving up. If the server is in a separate process, we will wait 3x 2 minutes before retrying the notification. The only downside is that the celery server needs to have access to the internet to ping the PuSH server. If that is a problem, we need to make the task belong to a special group of celery servers that has access to the internet. As a side effect, I believe I removed the limitation that prevented us from upgrading celery. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* prepare_queue_task: Take app not request.Elrond2012-12-261-2/+2
| | | | | | | | | First rename prepare_entry to prepare_queue_task, because this is really more like what this thing does. Thanks to Velmont for noting that we do not need a request in here, but an "app" is good enough. Which means, that this stuff can be called from tool scripts too.
* Processing: Factor out prepare_entry.Elrond2012-12-261-25/+3
| | | | | prepare_entry handles the task_id setup and generating a queue filename and file. it returns the queue file.