Skip to content

Conversation

@drfho
Copy link
Contributor

@drfho drfho commented Aug 31, 2025

Branch of #423 for evaluation of utilizing the ruamel.yaml-lib

vv['data'] = data
break
v.append((py.find('\t\t%s ='%kk), vv))
v.append((filedata.find('\t\t%s ='%kk), vv))
Copy link
Contributor Author

@drfho drfho Aug 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zmsdev: What is this find() intended for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be gone,,, Seems to have intended to include filedata.

…y/yaml

Hint @zmsdev: the function readRepository still aggregates the data models form yaml/py not compatible (for py where does mappingproxy-type come from?)
@zmsdev zmsdev marked this pull request as draft September 1, 2025 08:13
@drfho
Copy link
Contributor Author

drfho commented Sep 3, 2025

@zmsdev
Hint: he yaml-export may be blocked by filter-processes. This is fixed here: #426

@drfho
Copy link
Contributor Author

drfho commented Sep 4, 2025

@zmsdev
The are still two issues with the block scalars and some general handling probems:

Latest Issues

1. at the first export linebreaks within a block create indent spaces that are shown as diff code. A second export normalizes this


linebreaks

linebreaks2

2. the differentiation of the default, custom or keys - field values in lists or code-blocks is not type-consistent. Often DTML/PY code in keys is represented as a YAML-list


image
image ---

3. Omitting of fileds with a default-value may lead to override explicit 0-values by resetting them implicitly the with a default, after YAML-reimport

image

4. resource-attributes like the ones for JS- oder Readme-files are removed in the YAML-output

image

@drfho
Copy link
Contributor Author

drfho commented Sep 4, 2025

@zmsdev
for evaluation I revoke partially some tasks of yamlutil.__cleanup(), because the cleanup clean too much:
the upper comment [3[ shows that we cannot ommit "falsy values" in general

To avoid missing values it might be more safe to add any available to the output. I suppose this could be done more elegantly?

@zmsdev
Copy link
Contributor

zmsdev commented Sep 4, 2025

ad [1]:
this seems to be an issue of the ruaml.yaml lib. I would suggest won't fix for this problem.
ad [2];
the abuse of keys is intentionally. Keys was designed to be a constant list of keys. Allowing DTML, Py or ZPT for keys was introduced later. ZMS uses the same data-structure (list) and this is not an issue of the yaml-serialization by the repository-manager.
ad [4]:
can't reproduce / understand the issue.
resource-attributes are included in yaml, e.g.:
zms.formulator.lib:
Attrs:
- id: readme
name: README.md
mandatory: 0
multilang: 0
repetitive: 0
type: resource

@drfho
Copy link
Contributor Author

drfho commented Sep 4, 2025

@zmsdev
ad [2]: maybe we could somehow avoid to push mixed-typing into the editable yaml code. There is a ZMS-internal way to differ list and code (that create a list): this could be used for the ex/import, too? The export works with keyword-condition quite well (see following screen-image), but then the code blocks gets a string for import an this a list of single chars. Any idea how how to handle this symmatrical?

image

@zmsdev
Copy link
Contributor

zmsdev commented Sep 5, 2025

ad [2]:
I will try to find a solution.

@zmsdev
Copy link
Contributor

zmsdev commented Sep 5, 2025

@drfho
ad [2]:
applied a fix for the special needs of ZMSMetaobjManager.
Also refined the defaults for mandatory attributes

@drfho
Copy link
Contributor Author

drfho commented Jan 19, 2026

@zmsdev
py-syntax-based repos-sync still changes all models according to the "zero-paradigm"

Screen: left = main, right=fb_conf_init_yaml_ruamel
1

Screen: fb_conf_init_yaml_ruamel removes all false-attrs from the model
2

If branch fb_conf_init_yaml_ruamel would not force to remove all attr-keys with a 0/false-value UX will be better. Its helpful to allow mentioning "mandatory":0, so the authors can read, its not mandatory.

Tasks

  • revoke the key-removing edadfa8
  • set py-syntax-based repos-sync as default for ZMS5 (ZMS6 will switch to yaml) 234d2cf
  • easier ZMS5-updating: not re-installation needed if ruamel.yaml is missing (and py-syntax is used) 7d713ec
  • restored content model zero values from main-branch 1ba65c8

@drfho
Copy link
Contributor Author

drfho commented Jan 19, 2026

@zmsdev
There is still a hickup with the keys when it come to line-weise code-export:

The main-branch creates;

			,"keys":["##"
				,"master = context.getPortalMaster()"
				,"zmsclientids = []"
				,"def getZMSPortalClients(zmsclient):"
				,"	zmsclientids.append(zmsclient.getHome().id)"
				,"	for zmsclientid in zmsclient.getPortalClients():"
				,"		getZMSPortalClients(zmsclientid)"
				,"	zmsclientids.sort()"
				,"	return list(zmsclientids)"
				,"return [(id,id) for id in getZMSPortalClients(zmsclient=master)]"]

whereas this branch creates:

			,"keys":"##\nmaster = context.getPortalMaster()\nzmsclientids = []\ndef getZMSPortalClients(zmsclient):\n	zmsclientids.append(zmsclient.getHome().id)\n	for zmsclientid in zmsclient.getPortalClients():\n		getZMSPortalClients(zmsclientid)\n	zmsclientids.sort()\n	return list(zmsclientids)\nreturn [(id,id) for id in getZMSPortalClients(zmsclient=master)]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants