Commit Graph

19 Commits

Author SHA1 Message Date
Akihiro Motoki 7052b7f065 Address RemovedInDjango40Warning (7)
HttpRequest.is_ajax() was marked as deprecated since Django 3.1 and will be
removed in Django 4.0 [1].

While the current implementation of is_ajax() relies on a jQuery-specific way
of signifying AJAX as noted in the Django relnotes, horizon works with this.
Thus this commit copies the existing logic of HttpRequest.is_ajax() to the
horizon repo (as horizon.utils.http.is_ajax()) and consumes it.

https: //docs.djangoproject.com/en/4.0/releases/3.1/#features-deprecated-in-3-1
Change-Id: I3def53033524985818a891a1b9d4659fad4ba2ba
2022-02-04 16:27:32 +09:00
Akihiro Motoki 9b99f17100 Define default settings explicitly (horizon)
test_parse_isotime_filter in test_filters is updated to match
TIME_ZONE=UTC. Previously TIME_ZONE was not set in horizon.test.settings
and the default value America/Chicago was used. Horizon uses UTC as the
default value of TIME_ZONE, so it is better to use UTC for testing too.

horizon settings in openstack_dashboard.settings are moved to
under horizon.

Part of blueprint ini-based-configuration
Change-Id: I9abdbbe0dcefc08ffea61143e3c0a87ed87b2e2a
2019-09-12 15:05:56 +09:00
Adrian Turjak dc0ffaf2d8 Change session timeout to an idle timeout value
Add a new config SESSION_REFRESH (default True) which
turns SESSION_TIMEOUT into an idle timeout rather than
a hard timeout.

The existing hard timeout is awful UX, and while
SESSION_TIMEOUT could be set to a higher value, it
still makes for a somewhat unpleasant experience.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Icc6942e62c4e8d2fac57988b0a2233a8073b1944
2018-12-23 09:33:49 +09:00
Akihiro Motoki b5d9aa16ce Clarify middleware public methods
In Django 1.10 the new middleware interface was introduced [1].
process_request and process_response are no longer part of the interface.
On the other hand, process_exception is the part of the interface.

To clarify that we are using the new middleware interface,
it looks better to rename the methods in the old interface to private.

[1] https://docs.djangoproject.com/en/2.0/topics/http/middleware/

Change-Id: I0bb39321f3659458a86beb2b258e9e903392620a
2018-11-07 06:24:24 +09:00
Akihiro Motoki 64b67ac9e9 Update the doc links to the newest ones
The docstring of getExtensions service in cinder.service.js
was a copy from nova service and not correct. The docstring was
updated based on the current cinder v2 API.

Thanks to a recent improvement in reno, touching release notes
in older releases in the master branch no longer polute the rendered
release notes. Changing URLs (or other things) in the master branch
does not affect the rendered release notes, but updating URLs to the
latest would help avoiding mechanical patches of updating links :)

Change-Id: I2aec3adeb400323d42a3a5083f8bc0798eeff917
2018-03-20 16:22:05 +09:00
Akihiro Motoki 3ecda5ac67 django2: adopt New-style middleware
Django 1.10 introduces a new style of middleware and
the old style was removed in Django 2.0.

https://docs.djangoproject.com/en/2.0/releases/1.10/#new-style-middleware

blueprint django2-support
Change-Id: I2fba2b1b2b528096422df3ed558ad75a1b80bbb9
2018-03-03 07:22:35 +09:00
Akihiro Motoki 1a252cb5e8 django2: is_authenticated/is_anonymous is now property only
https://docs.djangoproject.com/en/2.0/releases/1.10/#user-is-auth-anon-deprecation

blueprint django2-support
Change-Id: I57a39417f0595eae8d1c06d7e61d0a67078bb231
2018-02-17 01:36:54 +09:00
chao liu a6aa51cf3f Remove unused code (_logout method and auth_views in base.py)
The _logout method was added before newton version and never used.
Also, "from openstack_auth import views as auth_views" is unused

Change-Id: Iae8de4ec0abd16f59a8025576c7f4297b2c6e542
2017-09-18 08:19:32 +00:00
Ivan Kolodyazhny 8f4e02c96d Show NotAuthorized error message on a separate page
Change-Id: I02d9d610a0e5feff7da14f86d003ec21010ab26a
Closes-Bug: #1709077
2017-08-29 16:37:04 +03:00
bhavani.cr 29a3768379 Use request.COOKIES to activate the timezone
This patch fixes the inconsistency in the instance
creation time.

Change-Id: Ic4afd9a03f0278883e0d00a2e075acaa4b4f8dc1
Co-Authored-By: bhavani <bhavani.r@nectechnologies.in>
Closes-Bug: #1418031
2017-07-11 17:32:28 +05:30
Akihiro Motoki 95629a337e Fix H405 (multi line docstring) warnings (horizon)
H405: multi line docstring summary not separated with an empty line

Partial-Bug: #1696996
Change-Id: I58f71206def1a25f3eda04b9297f1aa7d3caa646
2017-06-09 16:04:57 +00:00
Gábor Antal 34a3aa0ba8 Handle log message interpolation by the logger
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages
Change-Id: I51f50935f1eeffe4960562d6309dfdf05814e595
Closes-Bug: #1596829
2017-03-31 20:59:16 +09:00
Akihiro Motoki 61091388e9 hacking: noqa cleanup in horizon
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.

After this, there are 8 noqa under horizon/ :)

In addition to this, the following changes are made.

horizon/exceptions.py: The following imports are dropped.
They are not used anywhere.
  from django.http import HttpRequest
  from django.views.debug import CLEANSED_SUBSTITUTE

horizon/forms/__init__.py:
Some entries were missing in __all__. They are added.

Change-Id: I33b504ef6c396f0675e8a340867e2ca59c77c684
2017-03-17 19:38:47 +00:00
Jenkins 93904437f4 Merge "The background colour of the success message changed" 2017-03-06 05:01:44 +00:00
Liao Zhuodi 9293f3df39 use `set literal` to replace `set` which is twice faster than `set`
Change-Id: Id30381755e22a061c8daca73eb78b0e04a767075
2017-03-03 08:59:03 +00:00
Sharat Sharma 618d4e1737 The background colour of the success message changed
When the password is successfully changed, the background colour
of the success message is changed from red to green to avoid
users mistaking it for an error message.

Change-Id: Icbaae9f15d02368539e47cd5e929c19ed67b5fed
Closes-Bug: #1520486
2017-01-18 06:53:09 +00:00
Lu lei c2adfc7508 py3:Remove six.iterXXX
1、As mentioned in [1], we should avoid using six.iteritems/keys
achieve iterators. We can use dict.items/keys instead, as it wil
l return iterators in PY3 as well. And dict.items/keys will more
readable.
2、In py2, the performance about list should be negligible,
see the link [2].

[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/ 2015-June/066391.html

TrivialFix.

Change-Id: I9eb7c4a2b2f3a070735c610942538c8185eee3c6
2016-09-08 17:16:12 +08:00
Timur Sufiev 93af461e40 [Django] Allow to upload the image directly to Glance service
Since large Glance images even temporarily stored on dashboard side
tend to fill up Web Server filesystem, it is desirable to route image
payload directly to Glance service (which usually streams it to
storage backend, which in turn has plenty of space).

To make it possible we need to trick Django into thinking that a file
was selected inside FileInput, while its contents are not actually
transferred to Django server. Then, once image is created client-side
code needs to know the exact url the image payload needs to be
transferred to. Both tasks are solved via using ExternalFileField /
ExternalUploadMeta classes which allow to work around the usual Django
form processing workflow with minimal changes to CreateImage form
business logic.

The client-side code relies on CORS being enabled for Glance service
(otherwise browser would forbid the PUT request to a location
different from the one form content came from). In a Devstack setup
you'll need to edit [cors] section of glance-api.conf file, setting
`allowed_origin` setting to the full hostname of the web server (say,
http://<HOST_IP>/dashboard) and restart glance-api process.

A progress bar is implemented to track the progress of a file upload,
in case a really huge image is transferred.

The new machinery could be easily switched on/off with a single
setting `HORIZON_IMAGES_UPLOAD_MODE` set to 'direct' / 'legacy'.

Related-Bug: #1467890
Closes-Bug: #1403129
Implements blueprint: horizon-glance-large-image-upload
Change-Id: I01d02f75268186b43066df6fd966aa01c08e01d7
2016-08-16 14:30:38 +03:00
Kenji Ishii 5a9c4b0c28 Add feature to log operations of users to Horizon
To enable this feature, you can see the
/doc/source/topics/settings.rst on this patch.

Change-Id: I784b92104be244f7f288d7648c20e61e0a0c1d09
Implements: blueprint operation-history-log
2016-05-31 10:34:08 +00:00