Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nuxeo/nuxeo-drive into wip-
Browse files Browse the repository at this point in the history
…NXDRIVE-2929-upgrade-python-from-3.9.5-to-3.12.3
  • Loading branch information
poojadaine committed Sep 24, 2024
2 parents ec780d4 + a2622e2 commit 462f0a0
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 67 deletions.
15 changes: 12 additions & 3 deletions docs/changes/5.5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ Release date: `2024-xx-xx`

### Direct Transfer

- [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2):
- [NXDRIVE-2909](https://jira.nuxeo.com/browse/NXDRIVE-2909): Set container title when defining the Folder type from Document Type Selection using Direct Transfer
- [NXDRIVE-2915](https://jira.nuxeo.com/browse/NXDRIVE-2915): Translate "Document type" and "container type" labels on Direct Transfer popup

### Task Management
- [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2):

## GUI

- [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2):
- [NXDRIVE-2962] (https://jira.nuxeo.com/browse/NXDRIVE-2962): Update Translation Files

## Packaging / Build

- [NXDRIVE-2](https://jira.nuxeo.com/browse/NXDRIVE-2):
- [NXDRIVE-2970](https://jira.nuxeo.com/browse/NXDRIVE-2970): Fix security issue: urllib3's Proxy-Authorization request header isn't stripped during cross-origin redirects
- [NXDRIVE-2971](https://jira.nuxeo.com/browse/NXDRIVE-2971): Fix security issue: pyca/cryptography has a vulnerable OpenSSL included in cryptography wheels

## Tests

Expand All @@ -36,8 +39,13 @@ Release date: `2024-xx-xx`
## Minor Changes

- Upgraded `authlib` from 1.3.0 to 1.3.1
- Upgraded `black` from 23.12.1 to 24.8.0
- Upgraded `boto3` from 1.34.17 to 1.35.21
- Upgraded `botocore` from 1.34.17 to 1.35.21
- Upgraded `cachetools` from 5.3.3 to 5.5.0
- Upgraded `certifi` from 2023.7.22 to 2024.7.4
- Upgraded `cryptography` from 42.0.5 to 43.0.1
- Upgraded `docutils` from 0.20.1 to 0.21.2
- Upgraded `filelock` from 3.14.0 to 3.16.1
- Upgraded `flake8` from 6.1.0 to 7.1.1
- Upgraded `typing-extensions` from 4.9.0 to 4.12.2
- Upgraded `pre-commit` from 2.16.0 to 3.8.0
Expand All @@ -46,6 +54,7 @@ Release date: `2024-xx-xx`
- Upgraded `pyflakes` from 3.1.0 to 3.2.0
- Upgraded `pytest-benchmark` from 3.4.1 to 4.0.0
- Upgraded `setuptools` from 69.5.1 to 72.1.0
- Upgraded `urllib3` from 1.26.12 to 1.26.19
- Upgraded `zipp` from 3.18.0 to 3.20.0

## Technical Changes
Expand Down
4 changes: 3 additions & 1 deletion nxdrive/client/uploader/direct_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def upload(
"entity-type": "document",
"name": doc_pair.local_name,
"type": doc_pair.doc_type,
"properties{'dc:title'}": doc_pair.local_name,
"properties": {
"dc:title": doc_pair.local_name,
},
}
item = self.remote.upload_folder_type(
doc_pair.remote_parent_path,
Expand Down
6 changes: 3 additions & 3 deletions nxdrive/data/i18n/i18n-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"CHANNEL": "Canal",
"CHANNEL_CHANGE_SETTINGS": "Canal de mise à jour",
"CHANNEL_CONFIRM_DANGEROUS": "Confirmer le canal de développement ?",
"CHOOSE_PARTICIPANTS": "Choisir les participants",
"CHOOSE_PARTICIPANTS": "Choisir les participants %1",
"CLOSE": "Fermer",
"COMPLETED": "Terminés",
"COMPLETED_ON": "Terminée le %1",
Expand All @@ -49,7 +49,7 @@
"CONNECTION_REFUSED": "Connexion refusée",
"CONNECTION_SUCCESS": "Connexion réussie",
"CONNECTION_UNKNOWN": "Une erreur inconnue s'est produite lors de la connexion",
"CONSOLIDATE_REVIEW": "Consolider la consultation",
"CONSOLIDATE_REVIEW": "Consolider la consultation %1",
"CONTAINER_TYPE": "Type de dossier",
"CONTEXT_MENU_1": "Voir en ligne",
"CONTEXT_MENU_2": "Copier le lien de partage",
Expand Down Expand Up @@ -403,7 +403,7 @@
"USE_LIGHT_ICONS": "Utiliser des icônes claires",
"USE_SENTRY": "Activer les rapports d'erreur",
"USERNAME": "Utilisateur",
"VALIDATE_DOCUMENT": "Valider le document",
"VALIDATE_DOCUMENT": "Valider le document %1",
"WEB_AUTHENTICATION_WINDOW_TITLE": "Authentification web",
"WELCOME_MESSAGE": "Connectez-vous et synchronisez vos fichiers avec Nuxeo.",
"WINDOWS_ERROR_TITLE": "Erreur de document",
Expand Down
4 changes: 2 additions & 2 deletions nxdrive/data/i18n/i18n-ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"CHANNEL": "チャンネル",
"CHANNEL_CHANGE_SETTINGS": "チャンネルの更新",
"CHANNEL_CONFIRM_DANGEROUS": "開発チャンネルを確認しますか?",
"CHOOSE_PARTICIPANTS": "参加者を選択",
"CHOOSE_PARTICIPANTS": "参加者を選択 %1",
"CLOSE": "閉じる",
"COMPLETED": "完了",
"COMPLETED_ON": "%1上で完了",
Expand Down Expand Up @@ -191,7 +191,7 @@
"FOLDER_USED": "別のNuxeo Driveアカウントによって使用されているフォルダ",
"FREE_DISK_SPACE": "(空きディスク容量: %1)",
"GENERATING": "生成中…",
"GIVE_OPINION": "ご意見をお聞かせください",
"GIVE_OPINION": "ご意見をお聞かせください %1",
"HANDLE_TASKS": "タスクの処理",
"HELP": "ヘルプ",
"HISTORY": "履歴",
Expand Down
11 changes: 10 additions & 1 deletion nxdrive/data/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
"ADVANCED_SETTINGS": "Advanced settings",
"AGO": "ago",
"APPLY": "Apply",
"AUDIO": "Audio",
"AUTOLOCK": "Autolock",
"AUTH_EXPIRED": "Authentication expired",
"AUTH_UPDATE_ACTION": "Click here to log back in",
"AUTOMATIC": "Use Automatic Configuration Script",
"AUTOSTART": "Start on boot",
"AUTOMATICS": "Automatic",
"AUTOUPDATE": "Auto install new updates",
"AUTOUPDATE_DOWNGRADE": "Version not compatible with the server, a downgrade to %1 is needed. Synchronization won't start until then.",
"AUTOUPDATE_UPGRADE": "A new version %1 is available.",
Expand Down Expand Up @@ -57,7 +59,7 @@
"CONTEXT_MENU_4": "Upload content",
"CONTINUE": "Continue",
"CONTINUE_USING": "Continue using Drive %1",
"CREATE": "Create",
"CREATE": "create",
"CREATE_REPORT": "Generate bug report",
"DATETIME_FORMAT": "%x %X",
"DAYS": "Day(s)",
Expand Down Expand Up @@ -176,12 +178,14 @@
"FEATURE_SYNCHRONIZATION": "Enable or disable the bidirectional synchronization between the local environment and the Nuxeo Platform.\nA restart is needed to apply changes.",
"FEATURE_TASKS_MANAGEMENT": "Handle your tasks from Nuxeo Drive and receive notifications and reminders when a new task is assigned to you.",
"FEEDBACK_LINK": "Something is missing? Share your feedback here.",
"FILE": "File",
"FILE_ALREADY_EXISTS": "There is already a file named \"%1\" in this folder. Do you want to replace it with the one you're moving?",
"FILE_ALREADY_EXISTS_HEADER": "A duplicate file has been found.",
"FILE_PATH": "Path: %1",
"FILTERS_WINDOW_TITLE": "%1 - Filters",
"FILTERS_DISABLED": "You must wait for current synchronization actions to be done before filtering some folders.",
"FINALIZING": "Finalizing ...",
"FOLDER": "Folder",
"FOLDER_DOES_NOT_EXISTS": "This folder does not exist",
"FOLDER_DUPLICATES_DETECTED": "Duplicate folder detected",
"FOLDER_DUPLICATES_MSG": "The following folder(s) already exist under <a href=\"%1\">%2</a>:<ul>%3</ul>Please rename them or process to several transfers within those folders.",
Expand All @@ -197,6 +201,7 @@
"HISTORY": "History",
"HOST": "Host",
"HOURS_AGO": "%1 hours ago",
"IGNORE": "Ignore",
"IGNORES_SYSTRAY": "Ignored Files (%1)",
"IGNORE_PAIR": "Ignore this error",
"IGNORE_REASON_CORRUPT": "This file is ignored because its integrity cannot be verified.",
Expand Down Expand Up @@ -295,11 +300,14 @@
"OPEN_ROOT_FOLDER": "Open %1 folder",
"OPEN_SETTINGS": "Open settings",
"OPEN_WINDOW": "Open window",
"ORDERED_FOLDER": "Ordered Folder",
"OTHER": "Other",
"OVERRIDE": "Override",
"PASSWORD": "Password",
"PENDING_TASKS": "Review required",
"PERSONAL_SPACE": "Personal space",
"PENDING_TASK_REVIEWS": "New task to review",
"PICTURE": "Picture",
"PROXY": "Proxy",
"PROXY_APPLIED": "Proxy settings have been updated",
"PROXY_CHANGE_SETTINGS": "Proxy",
Expand Down Expand Up @@ -404,6 +412,7 @@
"USE_SENTRY": "Enable error reporting",
"USERNAME": "Username",
"VALIDATE_DOCUMENT": "Validate the Document %1",
"VIDEO": "Video",
"WEB_AUTHENTICATION_WINDOW_TITLE": "Web Authentication",
"WELCOME_MESSAGE": "Set your account and synchronize your files with the Nuxeo Platform.",
"WINDOWS_ERROR_TITLE": "Document error",
Expand Down
24 changes: 24 additions & 0 deletions nxdrive/gui/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from ..translator import Translator


def get_known_types_translations() -> dict:
KNOWN_FOLDER_TYPES = {
"OrderedFolder": Translator.get("ORDERED_FOLDER"),
"Folder": Translator.get("FOLDER"),
}
KNOWN_FILE_TYPES = {
"Audio": Translator.get("AUDIO"),
"File": Translator.get("FILE"),
"Picture": Translator.get("PICTURE"),
"Video": Translator.get("VIDEO"),
}
DEFAULT_TYPES = {
"Automatic": Translator.get("AUTOMATICS"),
"Create": Translator.get("CREATE"),
}

return {
"FOLDER_TYPES": KNOWN_FOLDER_TYPES,
"FILE_TYPES": KNOWN_FILE_TYPES,
"DEFAULT": DEFAULT_TYPES,
}
45 changes: 39 additions & 6 deletions nxdrive/gui/folders_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
)
from ..translator import Translator
from ..utils import find_icon, get_tree_list, sizeof_fmt
from .constants import get_known_types_translations
from .folders_model import FilteredDocuments, FoldersOnly
from .folders_treeview import DocumentTreeView, FolderTreeView

Expand Down Expand Up @@ -269,6 +270,11 @@ def __init__(
"dt_last_duplicates_behavior", default="create"
)

_types = get_known_types_translations()
self.KNOWN_FOLDER_TYPES = _types.get("FOLDER_TYPES", {})
self.KNOWN_FILE_TYPES = _types.get("FILE_TYPES", {})
self.DEFAULT_TYPES = _types.get("DEFAULT", {})

self.vertical_layout.addWidget(self._add_group_local())
self.vertical_layout.addWidget(self._add_group_remote())
self.vertical_layout.addWidget(self._add_group_options())
Expand Down Expand Up @@ -407,21 +413,35 @@ def _open_duplicates_doc(self, _: bool) -> None:
"""Open the duplicates management documentation in a browser tab."""
webbrowser.open_new_tab(DOC_URL)

def _check_for_known_types(self, is_folder_type: bool, /) -> None:
if is_folder_type:
for key, val in self.KNOWN_FOLDER_TYPES.items():
if key in self.containerTypeList:
self.containerTypeList.remove(key)
self.containerTypeList.append(val)
else:
for key, val in self.KNOWN_FILE_TYPES.items():
if key in self.docTypeList:
self.docTypeList.remove(key)
self.docTypeList.append(val)

def update_file_group(self, /) -> None:
self.cbDocType.clear()
self.cbDocType.addItem("Automatic", "create")
self.cbContainerType.clear()
if values := list(self.DEFAULT_TYPES.values()):
self.cbContainerType.addItem(values[0], values[1])
self.cbDocType.addItem(values[0], values[1])
if self.remote_folder_ref:
self.docTypeList = self.engine.remote.get_doc_enricher(
self.remote_folder_ref, "subtypes", False
)

self._check_for_known_types(False)
self.cbDocType.addItems(self.docTypeList)
self.cbContainerType.clear()
self.cbContainerType.addItem("Automatic", "create")
if self.remote_folder_ref:
self.containerTypeList = self.engine.remote.get_doc_enricher(
self.remote_folder_ref, "subtypes", True
)
self._check_for_known_types(True)
self.cbContainerType.addItems(self.containerTypeList)

def _add_subgroup_doc_type(self, layout: QVBoxLayout, /) -> None:
Expand Down Expand Up @@ -509,6 +529,18 @@ def _find_folders_duplicates(self) -> List[str]:

return folders

def get_known_type_key(self, is_folder: bool, type: str, /) -> str:
if type in self.DEFAULT_TYPES.values():
original_list = self.DEFAULT_TYPES
else:
original_list = (
self.KNOWN_FOLDER_TYPES if is_folder else self.KNOWN_FILE_TYPES
)
try:
return list(original_list.keys())[list(original_list.values()).index(type)]
except Exception:
return type

def accept(self) -> None:
"""Action to do when the OK button is clicked."""
super().accept()
Expand All @@ -518,9 +550,8 @@ def accept(self) -> None:
if self.cbDocType.currentIndex() == 0
else self.cbDocType.currentText()
)
folder_duplicates = self._find_folders_duplicates()

if folder_duplicates:
if folder_duplicates := self._find_folders_duplicates():
self.application.folder_duplicate_warning(
folder_duplicates,
self.remote_folder_title,
Expand All @@ -535,6 +566,8 @@ def accept(self) -> None:
doc_type = (
self.cbDocType.currentText() if self.cbDocType.currentIndex() != 0 else ""
)
doc_type = self.get_known_type_key(False, doc_type)
cont_type = self.get_known_type_key(True, cont_type)
self.engine.direct_transfer_async(
self.paths,
self.remote_folder.text(),
Expand Down
22 changes: 22 additions & 0 deletions tests/functional/test_document_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pathlib import Path

from nxdrive.gui.constants import get_known_types_translations
from nxdrive.translator import Translator


def get_folder(folder) -> Path:
return Path(__file__).parent.parent / "resources" / folder


def test_get_known_types_translations():
Translator(get_folder("i18n"))
assert Translator.locale() == "en"
res = get_known_types_translations()

known_folder_types = res.get("FOLDER_TYPES", {})
known_file_types = res.get("FILE_TYPES", {})
default_types = res.get("DEFAULT", {})

assert known_folder_types["Folder"] == Translator.get("FOLDER")
assert known_file_types["Audio"] == Translator.get("AUDIO")
assert default_types["Automatic"] == Translator.get("AUTOMATICS")
12 changes: 6 additions & 6 deletions tools/deps/requirements-tox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ appdirs==1.4.4 \
--hash=sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128 \
--hash=sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41
# via virtualenv
cachetools==5.3.3 \
--hash=sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945 \
--hash=sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105
cachetools==5.5.0 \
--hash=sha256:02134e8439cdc2ffb62023ce1debca2944c3f289d66bb17ead3ab3dede74b292 \
--hash=sha256:2cc24fb4cbe39633fb7badd9db9ca6295d766d9c2995f245725a46715d050f2a
# via tox
chardet==5.2.0 \
--hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \
Expand All @@ -22,9 +22,9 @@ distlib==0.3.8 \
--hash=sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784 \
--hash=sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64
# via virtualenv
filelock==3.14.0 \
--hash=sha256:43339835842f110ca7ae60f1e1c160714c5a6afd15a2873419ab185334975c0f \
--hash=sha256:6ea72da3be9b8c82afd3edcf99f2fffbb5076335a5ae4d03248bb5b6c3eae78a
filelock==3.16.1 \
--hash=sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0 \
--hash=sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435
# via tox
importlib-metadata==7.0.1 \
--hash=sha256:4805911c3a4ec7c3966410053e9ec6a1fecd629117df5adee56dfc9432a1081e \
Expand Down
Loading

0 comments on commit 462f0a0

Please sign in to comment.