Title: RFE: Support for add and delete operations in ldif.LDIFParser.parse_change_records() · Issue #567 · python-ldap/python-ldap · GitHub
Open Graph Title: RFE: Support for add and delete operations in ldif.LDIFParser.parse_change_records() · Issue #567 · python-ldap/python-ldap
X Title: RFE: Support for add and delete operations in ldif.LDIFParser.parse_change_records() · Issue #567 · python-ldap/python-ldap
Description: Issue description: LDIF files with multiple operations are not fully processed by ldif.LDIFParser.parse_change_records(). Operations of the change type "modify" are processed via handle_modify() but operations of the change type "add" or...
Open Graph Description: Issue description: LDIF files with multiple operations are not fully processed by ldif.LDIFParser.parse_change_records(). Operations of the change type "modify" are processed via handle_modify() bu...
X Description: Issue description: LDIF files with multiple operations are not fully processed by ldif.LDIFParser.parse_change_records(). Operations of the change type "modify" are processed via handle_m...
Opengraph URL: https://github.com/python-ldap/python-ldap/issues/567
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RFE: Support for add and delete operations in ldif.LDIFParser.parse_change_records()","articleBody":"# Issue description:\r\n\r\nLDIF files with multiple operations are not fully processed by ldif.LDIFParser.parse_change_records().\r\n\r\nOperations of the change type \"modify\" are processed via handle_modify() but operations of the change type \"add\" or \"delete\" are counted but otherwise simply ignored.\r\n\r\nExample of such an LDIF file:\r\n\r\n```\r\nversion: 1\r\n\r\ndn: cn=demo1,ou=groups,dc=example,dc=com\r\nchangetype: add\r\nobjectClass: groupOfNames\r\nobjectClass: nsMemberOf\r\nobjectClass: posixGroup\r\nobjectClass: top\r\ncn: demo1\r\ngidNumber: 99997\r\n\r\n\r\ndn: cn=demo2,ou=groups,dc=example,dc=com\r\nchangetype: add\r\nobjectClass: groupOfNames\r\nobjectClass: nsMemberOf\r\nobjectClass: posixGroup\r\nobjectClass: top\r\ncn: demo2\r\ngidNumber: 99996\r\n\r\n\r\ndn: cn=demo2,ou=groups,dc=example,dc=com\r\nchangetype: modify\r\nadd: description\r\ndescription: Eine zweite Testgruppe\r\n\r\n\r\ndn: cn=demo1,ou=groups,dc=example,dc=com\r\nchangetype: delete\r\n\r\n\r\n```\r\n\r\n\r\n# Steps to reproduce: \r\n\r\nCreate your own LDIF parser and an import for the test file shown:\r\n\r\n```\r\nfrom pathlib import Path\r\nfrom ldif import LDIFParser\r\n\r\nclass MyLDIFParser(LDIFParser):\r\n \r\n def __init__(self, input_file, ignored_attr_types=None, max_entries=0, process_url_schemes=None, line_sep='\\n'):\r\n super().__init__(input_file, ignored_attr_types, max_entries, process_url_schemes, line_sep)\r\n\r\n def handle(self, dn, entry):\r\n print(f\"MyLDIFParser::handle({dn})\")\r\n \r\n def handle_modify(self, dn, modops, controls=None):\r\n print(f\"MyLDIFParser::handle_modify({dn})\")\r\n\r\ndef main():\r\n p_change = Path(\"test_change.ldif\")\r\n ldifparser_change = MyLDIFParser(open(p_change), \"r\")\r\n ldifparser_change.parse_change_records()\r\n print(f\"Changetype counter: {ldifparser_change.changetype_counter}\")\r\n \r\n \r\n\r\nif __name__ == '__main__':\r\n main()\r\n```\r\n\r\nStart this test:\r\n\r\n```\r\n$ ./demo.py \r\nMyLDIFParser::handle_modify(cn=demo2,ou=groups,dc=example,dc=com)\r\nChangetype counter: {'add': 2, 'delete': 1, 'modify': 1, 'modrdn': 0}\r\n```\r\n\r\nOperating system: \r\nFedora 39\r\n\r\nPython version: \r\n- Python 3.6\r\n- Python 3.12\r\n\r\npython-ldap version: \r\n3.4.4","author":{"url":"https://github.com/fager","@type":"Person","name":"fager"},"datePublished":"2024-05-15T19:23:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/567/python-ldap/issues/567"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:48f21f75-0b6e-9fa0-c1f4-4dd752153cd8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED28:4DECD:6246AD7:7EB2999:6975A4DA |
| html-safe-nonce | 7fd7bc300ba61ad98f08e67cf10a13e8ff7bf0863d6f7477ea4cdb4487679ddb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDI4OjRERUNEOjYyNDZBRDc6N0VCMjk5OTo2OTc1QTREQSIsInZpc2l0b3JfaWQiOiI0MzE2OTE3MDIwMTkzMzAxNzIyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 98fed1291ff68738130c9ca022e51a80104244b8a48f93d00752a214b4cd6040 |
| hovercard-subject-tag | issue:2298677898 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-ldap/python-ldap/567/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f8bb8b5e9213e50dc1b193ffa1cd09f00e98062c04ee301d086f0acd46a3db77/python-ldap/python-ldap/issues/567 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f8bb8b5e9213e50dc1b193ffa1cd09f00e98062c04ee301d086f0acd46a3db77/python-ldap/python-ldap/issues/567 |
| og:image:alt | Issue description: LDIF files with multiple operations are not fully processed by ldif.LDIFParser.parse_change_records(). Operations of the change type "modify" are processed via handle_modify() bu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fager |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/python-ldap/python-ldap git https://github.com/python-ldap/python-ldap.git |
| octolytics-dimension-user_id | 33895877 |
| octolytics-dimension-user_login | python-ldap |
| octolytics-dimension-repository_id | 111794776 |
| octolytics-dimension-repository_nwo | python-ldap/python-ldap |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 111794776 |
| octolytics-dimension-repository_network_root_nwo | python-ldap/python-ldap |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width