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

pyPElib refactor needed #96

Open
CarolinaFernandez opened this issue Dec 18, 2012 · 1 comment
Open

pyPElib refactor needed #96

CarolinaFernandez opened this issue Dec 18, 2012 · 1 comment

Comments

@CarolinaFernandez
Copy link
Member

Hard-coded drivers

Also, the PersistenceEngine class has a hard-coded list of drivers (_drivers) instead of reading the corresponding directory: pypelib/persistence/backends/.

Hard-coded settings

Models inside pyPElib driver's (e.g. RuleModel and RuleTableModel) include hard-coded settings:

class PolicyRuleModel(models.Model):
    class Meta:
            """Machine exportable class"""
            app_label = 'vt_manager'
            db_table = 'pypelib_RuleModel'

that should be kept out of the code and be intuitive and easily configurable by a user, e.g. in /etc/pypelib/conf.d/.

Dynamic settings loading

After improving the previous point the settings will be outside the library, thus it would be interesting ( though maybe a bit performance costly, if heavily used ) to dynamically load these before performing any operation.

That could be done in a common code for every driver, e.g. the method _getDriver inside the PersistenceEngine class. Since this method is called prior to perform any operation it seems a good common point to load the settings file.

Note: the load of settings should be coded in a separate module.

@CarolinaFernandez
Copy link
Member Author

We may also need some kind of parameter to avoid asking about the application and database names (in which PyPElib data will be stored) inside ofver, since this seems to confuse users.

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

No branches or pull requests

1 participant