Skip to content

Commit

Permalink
Merge branch 'main' into fb_pip_using_pyproject_toml
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho authored Nov 21, 2024
2 parents 4482aa9 + a1b6d8a commit 59451dd
Show file tree
Hide file tree
Showing 236 changed files with 9,299 additions and 2,063 deletions.
78 changes: 78 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "ZMS Development Environment",
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.yml"],
// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "zope",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/home/zope/",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
"shutdownAction": "stopCompose",
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
// "ms-python.autopep8"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"python.defaultInterpreterPath": "/home/zope/venv/bin/python",
"window.zoomLevel": 0,
"git.ignoreMissingGitWarning": true,
"editor.minimap.enabled": false,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": false,
"workbench.iconTheme": "vs-minimal",
"files.associations": {
"*.zpt": "html",
"*.zcml": "xml"
},
"scm.alwaysShowActions": true,
"files.exclude": {
"*.pyc": true,
"*-all.min.*": true,
"**/cache/**": true,
"**/Data.*": true
},
"search.exclude": {
"**/apidocs/**": true
},
"files.eol": "\n",
"files.autoSave": "afterDelay",
"workbench.colorTheme": "Visual Studio Light",
"python.linting.enabled": false,
"python.formatting.provider": "none"
// "python.testing.pytestEnabled": false,
// "python.testing.unittestEnabled": true,
// "python.testing.unittestArgs": [
// "-v",
// "-s",
// "./tests",
// "-p",
// "test*.py"
// ],
// "[python]": {
// "editor.defaultFormatter": "ms-python.autopep8"
// }
}
}
}
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
6 changes: 6 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
zope:
volumes:
- .:/home/zope/workspace/:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ Products/zms/plugins/www/zms-all.min.js
Products/zms/plugins/www/i18n/*.js
Products/zms/overrides.zcml
.vscode/

*~
.*.swp

/.idea/

dist/
build/
docker/var/*
docker/var/log/
docker/**/var/*
docker/**/Extensions/*
/revisions.txt

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"folders": [
{
"name": "ZMS5-Docker",
"name": "ZMS-Docker",
"path": "../.."
},
],
Expand Down Expand Up @@ -30,49 +30,37 @@
"files.eol": "\n",
"files.autoSave": "afterDelay",
"workbench.colorTheme": "Visual Studio Light",
"python.linting.enabled": false,
"python.formatting.provider": "none",
// "python.testing.pytestEnabled": false,
// "python.testing.unittestEnabled": true,
// "python.testing.unittestArgs": [
// "-v",
// "-s",
// "./tests",
// "-p",
// "test*.py"
// ],
"python.linting.enabled": true
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "ZMS5-Docker",
"name": "ZMS-Docker",
"type": "debugpy",
"request": "launch",
"program": "/home/zope/venv/bin/runwsgi",
"justMyCode": false,
"console": "integratedTerminal",
"program": "/home/zope/venv/bin/runwsgi",
"args": [
"--debug",
"--verbose",
"/home/zope/venv/instance/zms5/etc/zope.ini",
"debug-mode=on",
"http_port=8087",
"/home/zope/etc/zope.ini",
],
"env": {
"PYTHONUNBUFFERED":"1",
"CONFIG_FILE": "/home/zope/venv/instance/zms5/etc/zope.ini",
"INSTANCE_HOME": "/home/zope/venv/instance/zms5",
"CLIENT_HOME": "/home/zope/venv/instance/zms5",
"CONFIG_FILE": "/home/zope/etc/zope.ini",
"INSTANCE_HOME": "/home/zope/",
"CLIENT_HOME": "/home/zope/",
"PYTHON": "/home/zope/venv/bin/python",
"SOFTWARE_HOME": "/home/zope/venv/bin"
},
"serverReadyAction":{
"pattern":"Serving on http://0.0.0.0:8087",
"uriFormat": "http://127.0.0.1:8087/manage_main",
"pattern":"Serving on http://0.0.0.0:80",
"uriFormat": "http://admin:admin@127.0.0.1:80/manage_main",
"action": "openExternally",
},
},
]
}
}
}
42 changes: 42 additions & 0 deletions .vscode/Native.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"folders": [
{
"name": "ZMS5",
"path": "../"
}
],
"settings": {
"python.defaultInterpreterPath": "~/vpy38/bin/python",
"window.zoomLevel": 0,
"git.ignoreMissingGitWarning": true,
"editor.minimap.enabled": false,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": false,
"workbench.iconTheme": "vs-minimal",
"files.associations": {
"*.zpt": "html",
"*.zcml": "xml"
},
"scm.alwaysShowActions": true,
"files.exclude": {
"*.pyc": true,
"*-all.min.*":true,
"**/cache/**": true,
"**/Data.*": true,
"**/docker/**/var/*": true
},
"search.exclude": {
"**/apidocs/**": true,
"*.pyc": true,
"*-all.min.*":true,
"**/cache/**": true,
"**/Data.*": true,
"**/docker/**/var/*": true
},
"files.eol": "\n",
"files.autoSave": "afterDelay",
"workbench.colorTheme": "Visual Studio Light",
"python.linting.enabled": true
},
"remoteAuthority": "wsl+Ubuntu"
}
9 changes: 8 additions & 1 deletion .vscode/ZMS5.code-workspace
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
// Copy of Native.code-workspace
"folders": [
{
"name": "ZMS5",
Expand Down Expand Up @@ -50,9 +51,15 @@
"*-all.min.*":true,
"**/cache/**": true,
"**/Data.*": true,
"**/docker/**/var/*": true
},
"search.exclude": {
"**/apidocs/**": true
"**/apidocs/**": true,
"*.pyc": true,
"*-all.min.*":true,
"**/cache/**": true,
"**/Data.*": true,
"**/docker/**/var/*": true
},
"files.eol": "\n",
"files.autoSave": "afterDelay",
Expand Down
10 changes: 8 additions & 2 deletions Products/zms/ZMSCharformatManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def manage_changeCharformat(self, lang, btn, REQUEST, RESPONSE):
""" ZMSCharformatManager.manage_changeCharformat """
message = ''
id = REQUEST.get('id', '')
target = REQUEST.get('target', None)

# Change.
# -------
Expand Down Expand Up @@ -206,7 +207,12 @@ def manage_changeCharformat(self, lang, btn, REQUEST, RESPONSE):
id = ''

# Return with message.
message = standard.url_quote(message)
return RESPONSE.redirect('manage_charformats?lang=%s&manage_tabs_message=%s&id=%s'%(lang, message, id))
if target=='zmi_manage_tabs_message' and btn == 'BTN_DELETE' and ids:
message = '%s: %s'%(self.getZMILangStr('MSG_DELETED')%len(ids), id)
REQUEST.set('manage_tabs_message', message)
return self.zmi_manage_tabs_message(lang=lang, id=id, extra={}, REQUEST=REQUEST, RESPONSE=RESPONSE)
else:
message = standard.url_quote(message)
return RESPONSE.redirect('manage_charformats?lang=%s&manage_tabs_message=%s&id=%s'%(lang, message, id))

################################################################################
4 changes: 4 additions & 0 deletions Products/zms/ZMSItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ def zmi_page_request(self, *args, **kwargs):
request.set('lang', langs[0])
if not request.get('manage_tabs_message'):
request.set( 'manage_tabs_message', self.getConfProperty('ZMS.manage_tabs_message', ''))
if not request.get('manage_tabs_warning_message'):
request.set( 'manage_tabs_warning_message',self.getConfProperty('ZMS.manage_tabs_warning_message',''))
if not request.get('manage_tabs_danger_message'):
request.set( 'manage_tabs_danger_message',self.getConfProperty('ZMS.manage_tabs_danger_message',''))
if 'zmi-manage-system' in request.form:
standard.set_session_value(self,'zmi-manage-system',int(request.get('zmi-manage-system',0)))
# AccessableObject
Expand Down
39 changes: 17 additions & 22 deletions Products/zms/ZMSMetadictManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ def manage_changeMetaProperties(self, btn, lang, REQUEST, RESPONSE=None):
t0 = time.time()
id = REQUEST.get('id', '')
target = 'manage_metas'
if btn == 'BTN_SAVE' or btn == 'BTN_DELETE':
target = REQUEST.get('target', target)

try:

Expand Down Expand Up @@ -290,21 +292,6 @@ def manage_changeMetaProperties(self, btn, lang, REQUEST, RESPONSE=None):
newDefault = REQUEST.get('attr_default_%s'%oldId, '')
self.setMetadictAttr( oldId, newId, newAcquired, newName, newType, newMandatory, newMultilang, newRepetitive, newCustom, newKeys, newDefault)
message += self.getZMILangStr('MSG_CHANGED')
newId = REQUEST['_id'].strip()
newAcquired = 0
newName = REQUEST['_name'].strip()
newType = REQUEST['_type'].strip()
newMandatory = REQUEST.get('_mandatory', 0)
newMultilang = REQUEST.get('_multilang', 0)
newRepetitive = REQUEST.get('_repetitive', 0)
newCustom = ''
if len(newId) > 0 and len(newName) > 0 and len(newType) > 0:
if newType == 'method':
newCustom += '<dtml-comment>--// BO '+ newId + ' //--</dtml-comment>\n'
newCustom += '\n'
newCustom += '<dtml-comment>--// EO '+ newId + ' //--</dtml-comment>\n'
self.setMetadictAttr( None, newId, newAcquired, newName, newType, newMandatory, newMultilang, newRepetitive, newCustom)
message += self.getZMILangStr('MSG_INSERTED')%newId

# Copy.
# -----
Expand Down Expand Up @@ -383,14 +370,22 @@ def manage_changeMetaProperties(self, btn, lang, REQUEST, RESPONSE=None):
error = str( sys.exc_info()[0])
if sys.exc_info()[1]:
error += ': ' + str( sys.exc_info()[1])
target = standard.url_append_params( target, { 'manage_tabs_error_message':error})
if target=='zmi_manage_tabs_message':
REQUEST.set('manage_tabs_error_message', error)
return self.zmi_manage_tabs_message(lang=lang, id=id, extra=extra)
else:
target = standard.url_append_params( target, { 'manage_tabs_error_message':error})

# Return with message.
target = standard.url_append_params( target, { 'lang':lang, 'id':id})
target = standard.url_append_params( target, extra)
if len( message) > 0:
message += ' (in '+str(int((time.time()-t0)*100.0)/100.0)+' secs.)'
target = standard.url_append_params( target, { 'manage_tabs_message':message})
return RESPONSE.redirect( target)
if target=='zmi_manage_tabs_message':
REQUEST.set('manage_tabs_message', message)
return self.zmi_manage_tabs_message(lang=lang, id=id, extra=extra)
else:
target = standard.url_append_params( target, { 'lang':lang, 'id':id})
target = standard.url_append_params( target, extra)
if len( message) > 0:
message += ' (in '+str(int((time.time()-t0)*100.0)/100.0)+' secs.)'
target = standard.url_append_params( target, { 'manage_tabs_message':message})
return RESPONSE.redirect( target)

################################################################################
19 changes: 11 additions & 8 deletions Products/zms/ZMSMetaobjManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,14 +1176,16 @@ def manage_changeProperties(self, lang, btn='', key='all', REQUEST=None, RESPONS
# Upload resource.
if newType in self.valid_uploadtypes or isinstance(newCustom, ZPublisher.HTTPRequest.FileUpload):
if len(getattr(newCustom, 'filename', '')):
newCustom = _blobfields.createBlobField( self, _blobfields.MyFile, newCustom)
newCustom = _blobfields.createBlobField( self, _blobfields.MyFile, newCustom)
else:
savedAttr = [x for x in savedAttrs if x['id'] == old_id][0]
syncZopeMetaobjAttr( self, newValue, savedAttr)
if savedAttr.get('ob'):
filename = savedAttr['ob'].title
data = bytes(zopeutil.readData(savedAttr['ob']))
newCustom = _blobfields.createBlobField( self, _blobfields.MyFile, {'filename':filename,'data':data})
old_savedAttrs = [x for x in savedAttrs if x['id'] == old_id]
if old_savedAttrs:
savedAttr = old_savedAttrs[0]
syncZopeMetaobjAttr( self, newValue, savedAttr)
if savedAttr.get('ob'):
filename = savedAttr['ob'].title
data = bytes(zopeutil.readData(savedAttr['ob']))
newCustom = _blobfields.createBlobField( self, _blobfields.MyFile, {'filename':filename,'data':data})
# Change attribute.
message += self.setMetaobjAttr( id, old_id, attr_id, newName, newMandatory, newMultilang, newRepetitive, newType, newKeys, newCustom, newDefault)
# Return with message.
Expand All @@ -1201,7 +1203,8 @@ def manage_changeProperties(self, lang, btn='', key='all', REQUEST=None, RESPONS
if (len(attr_id) > 0 and len(newName) > 0 and len(newType) > 0) or newType in self.getMetadictAttrs():
message += self.setMetaobjAttr( id, None, attr_id, newName, newMandatory, newMultilang, newRepetitive, newType, newKeys, newCustom, newDefault)
message += self.getZMILangStr('MSG_INSERTED')%attr_id
# Lang-Dict.
# Insert (multiple) new language keys at once.
# Ref: _multilangmanager.py#L647
for key in REQUEST.form.keys():
if key.startswith('_lang_dict_key_'):
i = int(key[len('_lang_dict_key_'):])
Expand Down
Loading

0 comments on commit 59451dd

Please sign in to comment.