Prevent duplicate sorcery wizards from being applied to sorcery object types.

This commit contains several changes to sorcery:

1) Application of sorcery configuration based on module name is automatically performed
when sorcery is opened for a module.
2) Sorcery will not attempt to apply the same wizard to an object type more than once.
3) Sorcery gives more exact results when attempting to apply a wizard, whether as the
default or based on configuration.

Sorcery unit tests still pass for me after making these changes.

Review: https://reviewboard.asterisk.org/r/3326



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@411159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2014-03-25 17:52:39 +00:00
parent 665461ef70
commit 7d174a1daf
10 changed files with 100 additions and 54 deletions

View File

@@ -933,7 +933,7 @@ int ast_bucket_init(void)
return -1;
}
if (ast_sorcery_apply_default(bucket_sorcery, "bucket", "bucket", NULL)) {
if (ast_sorcery_apply_default(bucket_sorcery, "bucket", "bucket", NULL) == AST_SORCERY_APPLY_FAIL) {
ast_log(LOG_ERROR, "Failed to apply intermediary for 'bucket' object type in Bucket sorcery\n");
return -1;
}
@@ -947,7 +947,7 @@ int ast_bucket_init(void)
ast_sorcery_object_field_register_custom(bucket_sorcery, "bucket", "created", "", timeval_str2struct, timeval_struct2str, NULL, 0, FLDSET(struct ast_bucket, created));
ast_sorcery_object_field_register_custom(bucket_sorcery, "bucket", "modified", "", timeval_str2struct, timeval_struct2str, NULL, 0, FLDSET(struct ast_bucket, modified));
if (ast_sorcery_apply_default(bucket_sorcery, "file", "bucket_file", NULL)) {
if (ast_sorcery_apply_default(bucket_sorcery, "file", "bucket_file", NULL) == AST_SORCERY_APPLY_FAIL) {
ast_log(LOG_ERROR, "Failed to apply intermediary for 'file' object type in Bucket sorcery\n");
return -1;
}