Commit Graph

50 Commits

Author SHA1 Message Date
Nathan Sprenkle
c97932fa99 fix: add missing protocol to web link for assets (#27220)
* fix: add missing protocol to web link for assets

* test: fix asset path test

* refactor: update asset web URL to use urljoin
2021-04-02 11:13:57 -04:00
M. Zulqarnain
41e5403f4e BOM-2369 (D): pyupgrade on contentstore/views (#26767)
* pyupgrade on contentstore/views

* Apply suggestions from code review

Co-authored-by: Usama Sadiq <usama.sadiq@arbisoft.com>

Co-authored-by: Usama Sadiq <usama.sadiq@arbisoft.com>
2021-03-05 14:55:14 +05:00
usamasadiq
7bbde8f0f5 Applied pylint-amnesty 2021-02-08 13:00:22 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Kyle McCormick
538dbf696b Import CMS code using fully qualified module names
or, using proper the proper Python 3 relative imports
(e.g., 'from .views import x') which are standard and
unambiguous.
2020-10-19 09:34:31 -04:00
Kyle McCormick
7538691484 Patch CMS app code in tests using fully qualified names 2020-10-19 09:34:31 -04:00
Tim McCormack
2a27fe0915 Remove bad "test_no_file" test case revealed by Django 2.1 upgrade (#23584)
Before Django 2.1, the dict was being stringified as `{'name': 'file.txt'}`
(note the single quotes) and producing a JSON parse error in
https://github.com/edx/edx-platform/blob/9cf2f9f/cms/djangoapps/contentstore/views/assets.py#L541
which was then converted to a 400 error. However, in Django 2.1,
django.test.client starts JSON-encoding request bodies when an appropriate
content-type is set:
https://github.com/django/django/compare/2.0.8..2.1#diff-97160f50594424a40f2621d5a3c581ccR320

This results in the JSON parse succeeding, and the expected error never
occurs; instead, there is a KeyError when the `locked` attribute is
missing from the dict.

For now, removing the test, since it is blocking Django 2 upgrade work,
and we need to get off of (unsupported) Django 1.11 ASAP.
We should probably repair and restore this test, but it is likely that
we'll want to change the code it is testing first, since that code is
insufficiently defensive and handles both multipart form data and JSON
without properly checking which kind it is dealing with, as well as
assuming too much about what keys are present in the JSON.

I've filed ARCHBOM-1090 for this followup work.
2020-04-02 13:59:20 -04:00
Feanil Patel
2df8b8226b Merge pull request #22643 from edx/feanil/2to3_asserts
Run `2to3 -f asserts . -w` on edx-platform.
2019-12-30 12:13:42 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Feanil Patel
70294b0ad2 Run 2to3 -f asserts . -w on edx-platform.
https://docs.python.org/3.5/library/2to3.html#2to3fixer-asserts
2019-12-30 10:22:19 -05:00
jinder1s
e727ded167 Explicitly setting string to byte 2019-09-30 09:37:06 -04:00
David Ormsbee
9a1385585f Convert response bytes to str before JSON parsing. (#21375)
Convert response bytes to str before JSON parsing.
2019-08-19 11:01:55 -04:00
arbisoft
9c6bb49abf Fixing python-modernize issues. 2019-07-09 16:21:12 +05:00
Jeremy Bowman
cd2e58e093 DEPR-16 Stop using deprecated OpaqueKey methods (#20248) 2019-04-16 17:59:16 -04:00
cclauss
bb31716c97 Use ==/!= to compare str, bytes, and int literals 2019-03-19 21:40:06 +01:00
Michael Roytman
8e667d8bdf Merge pull request #17287 from edx/mroytman/assets-api-zero-assets
mroytman/assets api zero assets
2018-01-23 16:16:43 -05:00
Michael Roytman
97954d48fb add condition for when no assets are found in the database 2018-01-23 15:13:12 -05:00
Tyler Hallada
ad773dac5c Add text_search param for searching by displayname 2018-01-22 19:05:43 -05:00
Michael Roytman
d98e7d4f24 add sort direction and asset types as part of the assets JSON response 2017-12-18 19:23:49 -05:00
Michael Roytman
282220dae5 refactor and add multiple filter functionality 2017-09-20 12:06:12 -04:00
cahrens
6f71706b17 Remove SlashSeparatedCourseKey from tests. 2017-08-07 14:49:30 -04:00
Andy Armstrong
ebb04ca396 Reorder Studio imports using isort 2017-05-30 17:00:50 -04:00
Ned Batchelder
8571ceabeb Fix many wrong-assert-type errors 2016-08-03 12:44:41 -04:00
Toby Lawrence
bb29ad5f30 Revert "Revert "[PERF-325] Add versioned course asset URLs when canonicalizing asset paths.""
This reverts commit 9967b6fd58.
2016-06-23 13:27:15 -04:00
Kevin Falcone
9967b6fd58 Revert "[PERF-325] Add versioned course asset URLs when canonicalizing asset paths."
We're seeing errors in NR from objects read out of the cache lacking the
'StaticContent' object has no attribute 'content_digest'
File "/edx/app/edxapp/edx-platform/common/djangoapps/contentserver/middleware.py",
    line 70, in process_request

This reverts commit 849ebc5f22.
2016-06-22 12:11:35 -04:00
Toby Lawrence
849ebc5f22 [PERF-325] Add versioned course asset URLs when canonicalizing asset paths. 2016-06-15 08:04:52 -04:00
utkjad
274e6de22b PLAT-734 Fix slow transaction due to multiple calls to unpickling 2015-07-21 13:56:38 +00:00
Zia Fazal
ed434c55d1 remove in-memory files
no need to create zero by in memory images

added contents to test upload files
2015-06-16 14:14:15 +05:00
Matt Drayer
3e52b8fad1 mattdrayer/SOL-947: Refactor Web/HTML certificate URL patterns 2015-06-06 23:15:17 -04:00
Matt Drayer
af7277cdd9 New Feature: Certificates Web View
- SOL-465: Initial implementation of certificates web view and signatories (names/titles)

- SOL-718 Close button is working properly

- SOL-801 Backbone Signatories Modeling

- SOL-803 Underscore template: Editor (Add)

- SOL-802 Signatories: Underscore template - Details

- SOL-804 Signatories: Underscore template: Editor (Edit)

- Add signatory delete Django view

- SOL-805 Signatory editor (Delete)

- Add Coffeescript router

- SOL-716 Jasmine Tests

- Added missing minified JS library

- client side validation of signatory fields

- SOL-390 signatories names

- Remove obsolete extends Sass files

- input maxlength limiting for signatory information

- SOL-389: Course title override

- SOL-466: Add capability to upload digitized signatures in Studio

- ziafazal: fixed css for upload signature image

- ziafazal: completed deletion of signature images

- UX-1741: Add initial static rendering/styling for Open edX web certs
  * creating new global static dir
  * adding static version of edX UX pattern library assets
  * adding web certificates static assets
  * adding static (+abstracted) web certificates rendering
  * creating two tiers of rendering (base + distinguished)
  * providing sample assets for certificate rendering
  * supporting RTL layouts
  * adding certifcates assests to edX static asset pipeline
  * temporarily hiding the mozilla open badges share action
  * wiring print button to print view/page
  * fixup! addressing conflict artifact in valid cert template
  * fixup! adding missing %hd-subsection sass extend + components comment clean up
  * fixup! correcting pattern library .hd-4 font-weight value

- SOL-468 Linked Student View for Web View Credential

- SOL-467: Add capability to upload organization logos for certificates

- SOL-391 / SOL-387: Signatory related info (assets) in certificates web view

- kelketek: Fixes for static asset collection in certificate HTML view.

- SOL-398 Web View: Public Access

- mattdrayer: Post-merge branch stabilization

- catong: Initial changes to Studio template and Help config file

- ziafazal: Branch stabilizations

- SOL-387: Display organization logo on LMS web view

- talbs/mattdrayer: Branch Stabilizations

- talbs: converting backpack action to use a button HTML element

- talbs: revising placeholder assets + their rendering in cert view

- mattdrayer: Username web view wireup

- SOL-386 Certificate Mode Previews

- SOL-905: Make organization logo and signatory signature uneditable

- SOL-922: Improve test coverage

- SOL-765: Add LinkedIn sharing

- [marco] temporary styling adjustment to account for smaller linkedin share image / fake button

- SOL-921: Address hardcoded template items

- SOL-927: Deleting certificate should delete org logo image also
  * updated invalid template
  * removed hr
  * fix invalid certificate error

- clrux: Add i18n to certificate templates and partials

- mattdrayer: Pylint violations

- SOL-920 Certificate Activation/Deactivation

- mattdrayer: Added LMS support

- SOL-932: Fix preview mode support in certificate view

- SOL-934: Fixed bug reported and broken tests

- SOL-935 removed the 'valid' word from web view title

- talbs: RTL support updates/fixes
  * revising certificate type icon/name vertical alignment
  * removing unused older certificate template
  * revising styling for message/banner actions
  * abstracting accomplishment type to use course mode + adding in honor/verified-specific placeholders

- mattdrayer: JSHint violations
2015-06-01 19:48:04 -04:00
Ben Patterson
176770efad Revert "Enable PyContracts during tests"
This reverts commit 4312c0e763.
2015-05-22 15:05:11 -04:00
Calen Pennington
4312c0e763 Enable PyContracts during tests 2015-05-20 15:07:18 -04:00
Syed Hassan Raza
825aaed67f Split course's assests can access through '/' in asset url 2015-04-08 11:22:25 -04:00
Jonathan Piacenti
8ad4d081fb Added library import and export via .tar.gz'd XML files. 2015-03-10 21:29:29 +00:00
Martyn James
dcc8e95648 Implements SOL-20. Filtering for assets table by asset type 2015-01-16 12:53:24 -05:00
John Eskew
94ea35d3be Export modulestore-stored asset metadata as XML to exported course.
Import asset metadata XML into modulestore.
Optimize importing many items of asset metadata by avoiding multiple
round-trips to MongoDB.
2014-12-16 15:42:38 -05:00
Jim
fb9320afc1 Limit Upload File Sizes to GridFS.
This commit puts a limit on the size of files that
course staff can upload to MongoDB. The limit is
enforced on the frontend in javascript as well
as backend via the /upload endpoint.

The limit is hard-coded in cms/envs/common.py and
may be changed according to the user's custom
needs.

If the user tries to upload a file that's too
large, an error message will pop up, with a
customizable url that pointing the user to an
external page with an alternate upload procedure.
This url is specified im cms/envs/common.py.
If not set, this url will not be displayed.
2014-12-09 13:30:45 -08:00
Don Mitchell
fc83c299ca Generalize assets to any block_type but using
AssetKey and the metadata store
PLAT-204
2014-11-05 16:01:50 -05:00
muhammad-ammar
fcaa783e43 Unit Test Improvements
TE-489
2014-10-31 11:55:13 +00:00
John Eskew
786a32e7cf Wrap all asset read operations.
First step in moving assets out of the contentstore (optionally).
https://openedx.atlassian.net/browse/PLAT-77
2014-10-28 14:20:36 -04:00
Nimisha Asthagiri
84992cdfa5 Refactor xml_importer.py for easier reading.
Remove post-publish step.
2014-08-08 14:41:57 -04:00
Nimisha Asthagiri
ea32529866 Fix all modulestore calls to pass in user ids. 2014-07-09 21:10:12 -04:00
Nimisha Asthagiri
a9213509c3 Enable Mixed Modulestore STUD-1540
Refactor get_parent_locations STUD-1663
2014-06-26 18:00:11 -04:00
Calen Pennington
cfcbdc0145 Move to OpaqueKey implementations from the external library
[LMS-2757]
2014-05-29 17:03:35 -04:00
Calen Pennington
0d88379eeb Make course ids and usage ids opaque to LMS and Studio [partial commit]
This commit adds all of cms.

These keys are now objects with a limited interface, and the particular
internal representation is managed by the data storage layer (the
modulestore).

For the LMS, there should be no outward-facing changes to the system.
The keys are, for now, a change to internal representation only. For
Studio, the new serialized form of the keys is used in urls, to allow
for further migration in the future.

Co-Author: Andy Armstrong <andya@edx.org>
Co-Author: Christina Roberts <christina@edx.org>
Co-Author: David Baumgold <db@edx.org>
Co-Author: Diana Huang <dkh@edx.org>
Co-Author: Don Mitchell <dmitchell@edx.org>
Co-Author: Julia Hansbrough <julia@edx.org>
Co-Author: Nimisha Asthagiri <nasthagiri@edx.org>
Co-Author: Sarina Canelake <sarina@edx.org>

[LMS-2370]
2014-05-07 12:56:43 -04:00
Jay Zoldak
c5a7911b87 Fix pylint disable pragmas that were pep8 violations 2014-03-20 10:18:40 -04:00
cahrens
8db7b0ce21 Add test for external_url being passed to assets page. 2014-02-26 09:26:50 -05:00
Giulio Gratta
3ffb6715e5 Internal/External Studio file URLs
- Changed link URL of file name to use public/LMS url
- Added toggle link to display all public URLs for instructor convenience
2014-02-24 11:54:09 -08:00
cahrens
c2aa0bf629 pep8 cleanup 2014-02-10 16:03:06 -05:00
cahrens
f9c1c0b38b Move tests related to views files into views/tests. 2014-02-10 16:03:06 -05:00