diff --git a/docs/function/allow_unsafe_import.soy b/docs/function/allow_unsafe_import.soy index f3fca6e07ee..414577c61d6 100644 --- a/docs/function/allow_unsafe_import.soy +++ b/docs/function/allow_unsafe_import.soy @@ -18,17 +18,32 @@ When + - -
Whitelistcopy, re, functools, itertools, json, hashlib, types, string, ast, __future__, collections, operator, fnmatch
Safe versionsos, os.path, pipes
+In the safe versions of modules only selected parts can be used. + + + + + + + + + +
ModuleAvailable parts
osenviron, getenv, path, sep, pathsep, linesep
os.pathbasename, commonprefix, dirname, isabs, join, normcase, +relpath, split, splitdrive, splitext, sep, pathsep
pipesquote
{/param} @@ -47,9 +62,19 @@ __future__, collections, operator, fnmatch Buck has no way to know if the results of uncontrolled file system or network access change, and will not reevaluate the build file if that happens. {literal}
+import copy # whitelisted
+import os   # safe version will be imported
 with allow_unsafe_import():
     from os.path import isfile
     import httplib
+
+# Warning! Buck will not detect that the existence of file A affects
+# the results of the parsing. The build file will not be processed
+# again when A is added/removed.
+if isfile(A):
+    foo()
+else:
+    bar()
 
{/literal} {/param}