mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 16:51:54 +00:00
do NOT inherit *date between *include files - policy decision
This commit is contained in:
parent
55bbccb4ca
commit
a63275f913
@ -399,6 +399,10 @@ class LoadingSurvex:
|
||||
but inheriting dates across *include files is almost certainly NOT
|
||||
expected behaviour, even though it is syntactically "correct",
|
||||
so triggers a Warning.
|
||||
|
||||
In fact, rather than give a warning, I think this is where troggle should diverge from
|
||||
a strict interpretation of how survex works. So I will change this so that *date
|
||||
is NOT inherited between different files.
|
||||
"""
|
||||
if survexblock.parent.name == "troggle_unseens":
|
||||
# Bolluxed up if we try to inherit from this random junk, so don't.
|
||||
@ -429,27 +433,30 @@ class LoadingSurvex:
|
||||
# parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) # child
|
||||
# )
|
||||
if survexblock.survexfile != survexblock.parent.survexfile:
|
||||
# This is noteworthy, however.
|
||||
# This is noteworthy, however. FORBID inheriting dates between files. NOT documented survex behaviour !!
|
||||
survexblock.date = None
|
||||
self.currentdate = None # unecessary duplication
|
||||
return None
|
||||
|
||||
if survexblock.parent.name == "rootblock":
|
||||
# Not a sensible thing to inherit a date from, even if a date exists, which it shouldn't...
|
||||
message = (
|
||||
f"- No *date. But not sensible to inherit from rootblock. From ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}"
|
||||
)
|
||||
print(self.insp + message)
|
||||
# stash_data_issue(
|
||||
# parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
# if survexblock.parent.name == "rootblock":
|
||||
# # Not a sensible thing to inherit a date from, even if a date exists, which it shouldn't...
|
||||
# message = (
|
||||
# f"- No *date. But not sensible to inherit from rootblock. From ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}"
|
||||
# )
|
||||
return
|
||||
else:
|
||||
message = (
|
||||
f"- Warning *date '{self.inheritdate:%Y-%m-%d}' INHERITED from DIFFERENT file:\n ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}\n {self.stackbegin} {self.inheritdate:%Y-%m-%d}"
|
||||
)
|
||||
print(self.insp + message)
|
||||
stash_data_issue(
|
||||
parser="survex", message=message, url=None, sb=(survexblock.parent.survexfile.path) # PARENT
|
||||
)
|
||||
return self.inheritdate
|
||||
# print(self.insp + message)
|
||||
# # stash_data_issue(
|
||||
# # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
# # )
|
||||
# return
|
||||
# else:
|
||||
# message = (
|
||||
# f"- Warning *date '{self.inheritdate:%Y-%m-%d}' INHERITED from DIFFERENT file:\n ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}\n {self.stackbegin} {self.inheritdate:%Y-%m-%d}"
|
||||
# )
|
||||
# print(self.insp + message)
|
||||
# stash_data_issue(
|
||||
# parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) # not the parent
|
||||
# )
|
||||
# return self.inheritdate
|
||||
else:
|
||||
# This is not an error in the Expo dataset.
|
||||
# Many files just holding *include lines do not have dates.
|
||||
|
Loading…
Reference in New Issue
Block a user