mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-02 02:38:30 +02:00
can't use getattr to get method
This commit is contained in:
parent
056088f035
commit
601342ab20
3 changed files with 7 additions and 3 deletions
|
@ -100,6 +100,7 @@
|
|||
"SAFE_EVAL_ERROR": "Safe eval error",
|
||||
"TEMPLATE_USED": "Template used",
|
||||
"MORE_IN_ERROR_LOG": "More information in the error.log file",
|
||||
"COPY_FUNCTION_FORBIDDEN": "Copying functions is forbidden"
|
||||
"COPY_FUNCTION_FORBIDDEN": "Copying functions is forbidden",
|
||||
"GET_METHOD_FORBIDDEN": "Using getattr on a method is forbidden"
|
||||
}
|
||||
}
|
|
@ -101,6 +101,7 @@
|
|||
"SAFE_EVAL_ERROR": "Erreur lors d'un safe eval",
|
||||
"TEMPLATE_USED": "Modèle utilisé",
|
||||
"MORE_IN_ERROR_LOG": "Plus d'information dans le fichier error.log",
|
||||
"COPY_FUNCTION_FORBIDDEN": "Impossible de copier une fonction"
|
||||
"COPY_FUNCTION_FORBIDDEN": "Impossible de copier une fonction",
|
||||
"GET_METHOD_FORBIDDEN": "Impossible d'utiliser getattr sur une méthode"
|
||||
}
|
||||
}
|
|
@ -37,7 +37,9 @@ class safe_function:
|
|||
Same as normal getattr, but magic attribute are banned
|
||||
"""
|
||||
if "__" in name: raise Exception(_("MAGIC_METHOD_FORBIDDEN", ' : "', name, '"'))
|
||||
return getattr(obj, name, default)
|
||||
attr = getattr(obj, name, default)
|
||||
if callable(attr): raise Exception(_("GET_METHOD_FORBIDDEN", ' : "', name, '"'))
|
||||
return attr
|
||||
|
||||
@staticmethod
|
||||
def type(obj: any):
|
||||
|
|
Loading…
Reference in a new issue