Changeset 4519:c4c0660af381 in livinglogic.python.xist for src/ll/orasql/scripts/oragrant.py
- Timestamp:
- 07/14/11 13:06:40 (8 years ago)
- Branch:
- default
- Tags:
- rel-3-22
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
src/ll/orasql/scripts/oragrant.py
r4470 r4519 58 58 The encoding of the output (if ``-x`` is not given; default is ``utf-8``). 59 59 60 ``--include`` : regexp 61 Only include objects in the output if their name contains the regular 62 expression. 63 64 ``--exclude`` : regexp 65 Exclude objects from the output if their name contains the regular 66 expression. 67 60 68 61 69 Example … … 69 77 70 78 71 import sys, os, argparse79 import sys, os, re, argparse 72 80 73 81 from ll import misc, astyle, orasql … … 93 101 p.add_argument("-m", "--mapgrantee", dest="mapgrantee", help="Map grantees (Python expression: list or dict)", default="True") 94 102 p.add_argument("-e", "--encoding", dest="encoding", help="Encoding for output (default %(default)s)", default="utf-8") 103 p.add_argument( "--include", dest="include", metavar="REGEXP", help="Include only objects whose name contains PATTERN (default: %(default)s)", type=re.compile) 104 p.add_argument( "--exclude", dest="exclude", metavar="REGEXP", help="Exclude objects whose name contains PATTERN (default: %(default)s)", type=re.compile) 95 105 96 106 args = p.parse_args(args) … … 121 131 122 132 def keep(obj): 123 if args.keepjunk: 124 return True 125 if "$" in obj.name or "/" in obj.name or obj.name.startswith("SYS_EXPORT_SCHEMA_"): 133 if ("$" in obj.name or "/" in obj.name or obj.name.startswith("SYS_EXPORT_SCHEMA_")) and not args.keepjunk: 134 return False 135 if args.include is not None and args.include.search(obj.name) is None: 136 return False 137 if args.exclude is not None and args.exclude.search(obj.name) is not None: 126 138 return False 127 139 return True