File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,29 @@ std::shared_ptr<const WorkspaceGroup> AnalysisDataServiceImpl::GroupUpdatedNotif
3939 */
4040const std::string AnalysisDataServiceImpl::isValid (const std::string &name) const {
4141 std::regex validName (" ^[a-zA-Z_][\\ w]*" );
42-
4342 std::string error = " " ;
4443
4544 if (!std::regex_match (name, validName)) {
4645 error =
4746 " Invalid object name '" + name +
4847 " '. Names must start with a letter or underscore and contain only alpha-numeric characters and underscores." ;
48+
49+ // Log a warning message to let user know we will stop allowing invalid variable names in the future.
50+ const std::string warningMessage =
51+ error + " \n "
52+ " Currently this is only a warning, but in a future version of Mantid this will raise an exception and "
53+ " the operation will fail.\n "
54+ " Please update your scripts to use valid Python identifiers for workspace names." ;
55+ Kernel::Logger log (" AnalaysisDataService" );
56+ log.warning (warningMessage);
4957 }
58+
59+ // Fail in debug mode if name is not valid.
60+ #ifndef NDEBUG
5061 return error;
62+ #endif
63+
64+ return " " ;
5165}
5266
5367/* *
You can’t perform that action at this time.
0 commit comments