Skip to content

Commit

Permalink
update disclosure systems exclusiveTypesPattern to allow absent pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Herm Fischer authored and Herm Fischer committed May 29, 2015
1 parent 0c1bb01 commit 6707e94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions arelle/DisclosureSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
from arelle.PluginManager import pluginClassMethods
from arelle.UrlUtil import isHttpUrl

def compileAttrPattern(elt, attrName, flags=None):
def compileAttrPattern(elt, attrName, flags=None, patternIfNoAttr=""):
attr = elt.get(attrName)
if attr is None: attr = ""
if attr is None:
# pattern to match if no attribute provided
if patternIfNoAttr is None:
return None # if None, then there is no pattern if attribute missing
attr = patternIfNoAttr # use default pattern
if flags is not None:
return re.compile(attr, flags)
else:
Expand Down Expand Up @@ -151,7 +155,7 @@ def select(self, name):
self.names = names
self.name = self.names[0]
self.validationType = dsElt.get("validationType")
self.exclusiveTypesPattern = compileAttrPattern(dsElt,"exclusiveTypesPattern")
self.exclusiveTypesPattern = compileAttrPattern(dsElt,"exclusiveTypesPattern", patternIfNoAttr=None)
if self.validationType not in self.pluginTypes:
self.EFM = self.validationType == "EFM"
self.GFM = self.validationType == "GFM"
Expand Down
3 changes: 2 additions & 1 deletion arelle/ModelXbrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,12 @@ def viewModelObject(self, objectId):
def effectiveMessageCode(self, messageCodes):
effectiveMessageCode = None
_validationType = self.modelManager.disclosureSystem.validationType
_exclusiveTypesPattern = self.modelManager.disclosureSystem.exclusiveTypesPattern

for argCode in messageCodes if isinstance(messageCodes,tuple) else (messageCodes,):
if (isinstance(argCode, ModelValue.QName) or
(_validationType and argCode.startswith(_validationType)) or
self.modelManager.disclosureSystem.exclusiveTypesPattern.match(argCode) == None):
(not _exclusiveTypesPattern or _exclusiveTypesPattern.match(argCode) == None)):
effectiveMessageCode = argCode
break
return effectiveMessageCode
Expand Down

0 comments on commit 6707e94

Please sign in to comment.