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

models: initial sequence implementation #6

Merged
merged 1 commit into from
Aug 12, 2016
Merged

models: initial sequence implementation #6

merged 1 commit into from
Aug 12, 2016

Conversation

omelkonian
Copy link
Contributor

@omelkonian omelkonian commented Aug 2, 2016

  • Added model for defining auto-incrementing sequences.
  • Features include user-defined keywords and hierarchical sequences.

Signed-off-by: Orestis Melkonian melkon.or@gmail.com

@jirikuncar
Copy link
Member

@omelkonian please try to be gentle with opening new PRs. You can always reopen and re-push to the same branch if you need.

@jirikuncar jirikuncar added this to the v1.0.0 milestone Aug 2, 2016
@omelkonian omelkonian restored the sequence-impl branch August 2, 2016 11:33
@omelkonian omelkonian reopened this Aug 2, 2016
@omelkonian omelkonian closed this Aug 2, 2016
@omelkonian omelkonian reopened this Aug 2, 2016
@jirikuncar jirikuncar changed the title WIP: sequence model WIP models: initial sequence implementation Aug 2, 2016
template = db.Column(db.String, unique=True)
"""The template of the sequence."""

parent = db.Column(ForeignKey(name))
Copy link
Member

Choose a reason for hiding this comment

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

db.ForeignKey

@omelkonian
Copy link
Contributor Author

omelkonian commented Aug 2, 2016

@jirikuncar I am currently implementing the admin view. Should I do a separate commit on this PR or a separate PR altogether?

@jirikuncar
Copy link
Member

@omelkonian it's better to do each feature in separate branch so we don't discuss about admin interface here when the models are good.

@jirikuncar
Copy link
Member

@omelkonian please add tests to keep the test coverage. Thanks!

class NoSuchSequence(Exception):
"""No such sequence error."""

pass
Copy link
Member

Choose a reason for hiding this comment

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

You don't need a pass if there is a docstring.

@omelkonian
Copy link
Contributor Author

@jirikuncar Just to clarify, the PRs should be merged in this order: #7 => #6 => #8

@omelkonian
Copy link
Contributor Author

@jirikuncar Revived API is up.

COUNTER_REGEX = re.compile(r'({counter(!.)?(:.*)?})')
"""Regular expression matching the counter inside the template string."""

id = db.Column(db.String, primary_key=True)
Copy link
Member

Choose a reason for hiding this comment

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

What about calling it name?

@omelkonian
Copy link
Contributor Author

@jirikuncar @egabancho Please check updated version. I think it much clearer now :)


:param name: the identifying name of the sequence
:param template: the template string of the sequence
:param start: the starting counter of the sequence
Copy link
Member

Choose a reason for hiding this comment

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

move the docs to create method

@omelkonian
Copy link
Contributor Author

@jirikuncar Please wait for docstrings update (due to renaming) before merging.

def __init__(self, name, _model=None):
"""Initialize template.

:param name: the identifying name of the template
Copy link
Member

Choose a reason for hiding this comment

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

Please start all param descriptions with capital letter and finish with a dot. Thanks

@omelkonian
Copy link
Contributor Author

@jirikuncar I will add the repr methods with the admin PR.

@jirikuncar
Copy link
Member

@omelkonian please rebase and we can :shipit:

@omelkonian
Copy link
Contributor Author

omelkonian commented Aug 11, 2016

ping @jirikuncar @egabancho

from __future__ import absolute_import, print_function

from invenio_db import db
from invenio_sequencegenerator.errors import SequenceNotFound
Copy link
Member

Choose a reason for hiding this comment

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

can we use relative imports like in the rest of the package?

@egabancho
Copy link
Member

LGTM

* Added model for defining auto-incrementing sequences.

* Added convenient API using iterators.

* Features include user-defined keywords and hierarchical sequences.

* Added tests for complete coverage.

Signed-off-by: Orestis Melkonian <melkon.or@gmail.com>
@jirikuncar jirikuncar merged commit f305816 into inveniosoftware:master Aug 12, 2016
@omelkonian omelkonian deleted the sequence-impl branch August 12, 2016 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants