Browse Source

Mar 15 [UPDT] : Updated 'auto_database_backup'

pull/278/merge
AjmalCybro 1 year ago
parent
commit
1f6b6ab42b
  1. 2
      auto_database_backup/__manifest__.py
  2. 8
      auto_database_backup/doc/RELEASE_NOTES.md
  3. 7
      auto_database_backup/models/db_backup_configure.py

2
auto_database_backup/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': "Automatic Database Backup To Local Server, Remote Server," 'name': "Automatic Database Backup To Local Server, Remote Server,"
"Google Drive, Dropbox, Onedrive, Nextcloud and Amazon S3", "Google Drive, Dropbox, Onedrive, Nextcloud and Amazon S3",
'version': '16.0.3.0.2', 'version': '16.0.4.0.1',
'category': 'Extra Tools', 'category': 'Extra Tools',
'summary': 'Generate automatic backup of databases and store to local, ' 'summary': 'Generate automatic backup of databases and store to local, '
'google drive, dropbox, nextcloud, amazon S3, onedrive or ' 'google drive, dropbox, nextcloud, amazon S3, onedrive or '

8
auto_database_backup/doc/RELEASE_NOTES.md

@ -21,3 +21,11 @@
#### UPDT #### UPDT
- Updated the database name check function which got access denied when list_db=False. - Updated the database name check function which got access denied when list_db=False.
## Module <auto_database_backup>
#### 16.02.2024
#### Version 16.0.4.0.1
#### UPDT
- Fixed internal server error in Onedrive and Google Drive integration.

7
auto_database_backup/models/db_backup_configure.py

@ -438,6 +438,9 @@ class DbBackupConfigure(models.Model):
res = requests.post( res = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/token", "https://login.microsoftonline.com/common/oauth2/v2.0/token",
data=data, headers=headers) data=data, headers=headers)
if res.status_code != 200:
raise ValidationError(
"Bad microsoft onedrive request..!")
res.raise_for_status() res.raise_for_status()
response = res.content and res.json() or {} response = res.content and res.json() or {}
if response: if response:
@ -525,12 +528,16 @@ class DbBackupConfigure(models.Model):
def set_dropbox_refresh_token(self, auth_code): def set_dropbox_refresh_token(self, auth_code):
"""Generate and set the dropbox refresh token from authorization code""" """Generate and set the dropbox refresh token from authorization code"""
try:
dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect( dbx_auth = dropbox.oauth.DropboxOAuth2FlowNoRedirect(
self.dropbox_client_key, self.dropbox_client_key,
self.dropbox_client_secret, self.dropbox_client_secret,
token_access_type='offline') token_access_type='offline')
outh_result = dbx_auth.finish(auth_code) outh_result = dbx_auth.finish(auth_code)
self.dropbox_refresh_token = outh_result.refresh_token self.dropbox_refresh_token = outh_result.refresh_token
except Exception:
raise ValidationError(
'Please Enter Valid Authentication Code')
@api.constrains('db_name') @api.constrains('db_name')
def _check_db_credentials(self): def _check_db_credentials(self):

Loading…
Cancel
Save