1
2
3 """
4 upload plugin
5
6 Plugin read by omero.cli.Cli during initialization. The method(s)
7 defined here will be added to the Cli class for later use.
8
9 Copyright 2007 Glencoe Software, Inc. All rights reserved.
10 Use is subject to license terms supplied in LICENSE.txt
11
12 """
13
14 import sys
15 import re
16
17 from omero.cli import BaseControl, CLI
18
19 import omero
20 import omero.rtypes
21 import omero.util.originalfileutils
22
23
24 try:
25 import hashlib
26 hash_sha1 = hashlib.sha1
27 except:
28 import sha
29 hash_sha1 = sha.new
30
31 HELP = """Upload local files to the OMERO server"""
32 RE = re.compile("\s*upload\s*")
33
34
36
37 - def _complete(self, text, line, begidx, endidx):
38 """
39 Returns a file after "upload" and otherwise delegates to the
40 BaseControl
41 """
42 m = RE.match(line)
43 if m:
44 return self._complete_file(RE.sub('', line))
45 else:
46 return BaseControl._complete(self, text, line, begidx, endidx)
47
56
69
70 try:
71 register("upload", UploadControl, HELP)
72 except NameError:
73 if __name__ == "__main__":
74 cli = CLI()
75 cli.register("upload", UploadControl, HELP)
76 cli.invoke(sys.argv[1:])
77