Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACP-22 Adapter to make the generation of custom IDs easier #83

Merged
merged 2 commits into from
May 9, 2017

Conversation

nihadness
Copy link
Contributor

To override ID generators, added adapter control to renameAfterCreation function in idserver. So, if an object has an adapter providing IIdServer from bika.lims.interfaces, then it will call its generate_id method right after it is created to rename it.

# Checking if an adapter exists for this content type. If yes, we will
# get new_id from adapter.
for name, adapter in getAdapters((obj, ), IIdServer):
new_id = adapter.generate_id(obj.portal_type)
Copy link

Choose a reason for hiding this comment

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

It would be a good idea to add a log if more than one adapters are found.
Something like that should be enough

for name, adapter in getAdapters((obj, ), IIdServer):
    if new_id is not None:
        logger.warn('More than one id server adapters found for {} content type.'.format(obj.gettype()))
    new_id = adapter.generate_id(obj.portal_type)

@Espurna Espurna merged commit 732100a into wip May 9, 2017
@xispa xispa deleted the task/ACP-22-custom-AR-ID branch August 24, 2017 08:07
@xispa xispa changed the title ACP-22/ Generating specific IDs ACP-22 Adapter to make the generation of custom IDs easier Oct 9, 2017
Ruhanga pushed a commit to Ruhanga/senaite.core that referenced this pull request Mar 14, 2022
* client field in doctor

* Adding doctors acction for client portal_type

* doctors view added for client folder

* added index to filter doctors by clients

* permissions to view doctors

* add permissions

* fixing import error

* using bika api

* easier to understand sort

* logger outside the loop

* docstring

* docstring

* docstring

* Reindex doctors folder to update permissions

* better performant get_client method

* improving upgradestep

* remove propertiestool

* Fixed error because of missing Value for allowedRolesAndUsers

* Update CHANGES.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants