bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-1], HTTP_METHODS[-1]))) if len(args) == 0: raise TooFewArgsForHTTPError, 'HTTP command %s requires a URI' % method uri = args[0] tags = form_tag_value_pairs(args[1:]) if method == 'PUT': body = {tags[0].tag : tags[0].value} tags = tags[1:] else: body=None hash = {} for pair in tags: hash[pair.name] = pair.value status, result = db.call (method, uri, body, hash) print 'Status: %d' % status print 'Result: %s' % str (result)
|
def execute_http_request(action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-1], HTTP_METHODS[-1]))) if len(args) == 0: raise TooFewArgsForHTTPError, 'HTTP command %s requires a URI' % method uri = args[0] tags = form_tag_value_pairs(args[1:]) if method == 'PUT': body = {tags[0].tag : tags[0].value} tags = tags[1:] else: body=None hash = {} for pair in tags: hash[pair.name] = pair.value status, result = db.call (method, uri, body, hash) print 'Status: %d' % status print 'Result: %s' % str (result)
| 471,900
|
def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-1], HTTP_METHODS[-1]))) if len(args) == 0: raise TooFewArgsForHTTPError, 'HTTP command %s requires a URI' % method uri = args[0] tags = form_tag_value_pairs(args[1:]) if method == 'PUT': body = {tags[0].tag : tags[0].value} tags = tags[1:] else: body=None hash = {} for pair in tags: hash[pair.name] = pair.value status, result = db.call (method, uri, body, hash) print 'Status: %d' % status print 'Result: %s' % str (result)
|
def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-1], HTTP_METHODS[-1]))) if len(args) == 0: raise TooFewArgsForHTTPError, 'HTTP command %s requires a URI' % method uri = args[0] tags = form_tag_value_pairs(args[1:]) if method == 'PUT': body = {tags[0].tag : tags[0].value} tags = tags[1:] else: body=None hash = {} for pair in tags: hash[pair.name] = pair.value status, result = db.call(method, uri, body, hash) print 'Status: %d' % status print 'Result: %s' % str (result)
| 471,901
|
def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-1], HTTP_METHODS[-1]))) if len(args) == 0: raise TooFewArgsForHTTPError, 'HTTP command %s requires a URI' % method uri = args[0] tags = form_tag_value_pairs(args[1:]) if method == 'PUT': body = {tags[0].tag : tags[0].value} tags = tags[1:] else: body=None hash = {} for pair in tags: hash[pair.name] = pair.value status, result = db.call (method, uri, body, hash) print 'Status: %d' % status print 'Result: %s' % str (result)
|
def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-1], HTTP_METHODS[-1]))) if len(args) == 0: raise TooFewArgsForHTTPError, 'HTTP command %s requires a URI' % method uri = args[0] tags = form_tag_value_pairs(args[1:]) if method == 'PUT': body = {tags[0].tag : tags[0].value} tags = tags[1:] else: body=None hash = {} for pair in tags: hash[pair.name] = pair.value status, result = db.call (method, uri, body, hash) print 'Status: %d' % status print 'Result: %s' % str (result)
| 471,902
|
def execute_command_line (action, args, options, parser): db = FluidDB(host=options.hostname, debug=options.debug) ids_from_queries = chain(*imap(lambda q: get_ids_or_fail(q, db), options.query)) ids = chain(options.id, ids_from_queries) objs = [O({'mode': 'about', 'specifier': a}) for a in options.about] + \ [O({'mode': 'id', 'specifier': id}) for id in ids] if (action.upper() not in HTTP_METHODS + ['COUNT'] and not args): parser.error('Too few arguments for action %s' % action) elif action == 'count': print "Total: %d objects" % (len(objs)) elif action in ('tag', 'untag', 'show'): if not (options.about or options.query or options.id): parser.error('You must use -q, -a or -i with %s' % action) tags = args if len(tags) == 0 and action != 'count': nothing_to_do() actions = { 'tag': execute_tag_command, 'untag': execute_untag_command, 'show': execute_show_command, } command = actions[action] command(objs, db, tags, options) elif action in ['get', 'put', 'post', 'delete']: execute_http_request (action, args, db, options) else: parser.error('Unrecognized command %s' % action)
|
def execute_command_line (action, args, options, parser): db = FluidDB(host=options.hostname, debug=options.debug) ids_from_queries = chain(*imap(lambda q: get_ids_or_fail(q, db), options.query)) ids = chain(options.id, ids_from_queries) objs = [O({'mode': 'about', 'specifier': a}) for a in options.about] + \ [O({'mode': 'id', 'specifier': id}) for id in ids] if (action.upper() not in HTTP_METHODS + ['COUNT'] and not args): parser.error('Too few arguments for action %s' % action) elif action == 'count': print "Total: %d objects" % (len(objs)) elif action in ('tag', 'untag', 'show'): if not (options.about or options.query or options.id): parser.error('You must use -q, -a or -i with %s' % action) tags = args if len(tags) == 0 and action != 'count': nothing_to_do() actions = { 'tag': execute_tag_command, 'untag': execute_untag_command, 'show': execute_show_command, } command = actions[action] command(objs, db, tags, options) elif action in ['get', 'put', 'post', 'delete']: execute_http_request(action, args, db, options) else: parser.error('Unrecognized command %s' % action)
| 471,903
|
def choose_host (): if 'options' in globals(): host = options.hostname if options.verbose: print "Chosen %s as host" % host return host else: return FLUIDDB_PATH
|
def choose_host(): if 'options' in globals(): host = options.hostname if options.verbose: print "Chosen %s as host" % host return host else: return FLUIDDB_PATH
| 471,904
|
def choose_debug_mode (): return options.debug if 'options' in globals () else False
|
def choose_debug_mode (): return options.debug if 'options' in globals () else False
| 471,905
|
def choose_http_timeout (): return (options.timeout if 'options' in globals() else HTTP_TIMEOUT)
|
def choose_http_timeout (): return (options.timeout if 'options' in globals() else HTTP_TIMEOUT)
| 471,906
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host)
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host)
| 471,907
|
def testCreateObject (self): db = self.db o = db.create_object ('DADGAD') self.assertEqual (o.id, self.dadgadID) self.assertEqual (o.URI, object_uri (self.dadgadID))
|
def testCreateObject (self): db = self.db o = db.create_object ('DADGAD') self.assertEqual (o.id, self.dadgadID) self.assertEqual (o.URI, object_uri (self.dadgadID))
| 471,908
|
def testCreateObjectNoAbout (self): db = self.db o = db.create_object () self.assertEqual (type (o) != types.IntType, True)
|
def testCreateObjectNoAbout (self): db = self.db o = db.create_object () self.assertEqual (type (o) != types.IntType, True)
| 471,909
|
def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not
|
def testCreateTag (self): db = self.db o = db.delete_abstract_tag('testrating') # doesn't really matter if this works or not
| 471,910
|
def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not
|
def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not
| 471,911
|
def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not
|
def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not
| 471,912
|
def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
|
def testSetTagByID(self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
| 471,913
|
def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
|
def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag('testrating') o = db.create_abstract_tag('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
| 471,914
|
def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
|
def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
| 471,915
|
def testSetTagByAbout (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_about ('DADGAD', '/%s/testrating' % user, 'five') self.assertEqual (o, 0) _status, v = db.get_tag_value_by_about ('DADGAD', 'testrating') self.assertEqual (v, 'five')
|
def testSetTagByAbout (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_about ('DADGAD', '/%s/testrating' % user, 'five') self.assertEqual (o, 0) _status, v = db.get_tag_value_by_about ('DADGAD', 'testrating') self.assertEqual (v, 'five')
| 471,916
|
def testDeleteNonExistentTag (self): db = self.db o = db.delete_abstract_tag ('testrating') o = db.delete_abstract_tag ('testrating') # definitely doesn't exist
|
def testDeleteNonExistentTag (self): db = self.db o = db.delete_abstract_tag ('testrating') o = db.delete_abstract_tag ('testrating') # definitely doesn't exist
| 471,917
|
def testSetNonExistentTag (self): db = self.db o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_id (self.dadgadID, 'testrating', 5) self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
|
def testSetNonExistentTag (self): db = self.db o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_id (self.dadgadID, 'testrating', 5) self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5)
| 471,918
|
def testUntagObjectByID (self): db = self.db
|
def testUntagObjectByID (self): db = self.db
| 471,919
|
def testUntagObjectByID (self): db = self.db
|
def testUntagObjectByID (self): db = self.db
| 471,920
|
def testUntagObjectByID (self): db = self.db
|
def testUntagObjectByID (self): db = self.db
| 471,921
|
def testUntagObjectByID (self): db = self.db
|
def testUntagObjectByID (self): db = self.db
| 471,922
|
def testUntagObjectByAbout (self): db = self.db
|
def testUntagObjectByAbout (self): db = self.db
| 471,923
|
def testUntagObjectByAbout (self): db = self.db
|
def testUntagObjectByAbout (self): db = self.db
| 471,924
|
def testAddValuelessTag (self): db = self.db o = db.delete_abstract_tag ('testconvtag') o = db.create_abstract_tag ('testconvtag', "a conventional (valueless) tag") o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.assertEqual (v, None)
|
def testAddValuelessTag (self): db = self.db o = db.delete_abstract_tag('testconvtag') o = db.create_abstract_tag('testconvtag', "a conventional (valueless) tag") o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.assertEqual (v, None)
| 471,925
|
def testAddValuelessTag (self): db = self.db o = db.delete_abstract_tag ('testconvtag') o = db.create_abstract_tag ('testconvtag', "a conventional (valueless) tag") o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.assertEqual (v, None)
|
def testAddValuelessTag (self): db = self.db o = db.delete_abstract_tag ('testconvtag') o = db.create_abstract_tag ('testconvtag', "a conventional (valueless) tag") o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.assertEqual (v, None)
| 471,926
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host)
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host)
| 471,927
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual(db.full_tag_path('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
| 471,928
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual(db.full_tag_path('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
| 471,929
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual(db.full_tag_path('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
| 471,930
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual(db.full_tag_path('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
| 471,931
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual(db.full_tag_path('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
| 471,932
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
|
def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('foo/rating'), '/tags/%s/foo/rating' % user) self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), '/tags/%s/foo/rating' % user) self.assertEqual(db.full_tag_path('/tags/%s/foo/rating' % user), '/tags/%s/foo/rating' % user)
| 471,933
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
|
def testAbsTagPath(self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
| 471,934
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual(db.abs_tag_path('rating'), '/%s/rating' % user) self.assertEqual(db.abs_tag_path('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
| 471,935
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual(db.abs_tag_path('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
| 471,936
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual(db.abs_tag_path('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
| 471,937
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual(db.abs_tag_path('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
| 471,938
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
|
def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('foo/rating'), '/%s/foo/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), '/%s/foo/rating' % user) self.assertEqual(db.abs_tag_path('/tags/%s/foo/rating' % user), '/%s/foo/rating' % user)
| 471,939
|
def testTagPathSplit (self): db = self.db
|
def testTagPathSplit(self): db = self.db
| 471,940
|
def testTagPathSplit (self): db = self.db
|
def testTagPathSplit (self): db = self.db
| 471,941
|
def testTypedValueInterpretation (self): corrects = { 'TRUE' : (True, types.BooleanType), 'tRuE' : (True, types.BooleanType), 't' : (True, types.BooleanType), 'T' : (True, types.BooleanType), 'f' : (False, types.BooleanType), 'false' : (False, types.BooleanType), '1' : (1, types.IntType), '+1' : (1, types.IntType), '-1' : (-1, types.IntType), '0' : (0, types.IntType), '+0' : (0, types.IntType), '-0' : (0, types.IntType), '123456789' : (123456789, types.IntType), '-987654321' : (-987654321, types.IntType), '011' : (11, types.IntType), '-011' : (-11, types.IntType), '3.14159' : (float ("3.14159"), types.FloatType), '-3.14159' : (float ("-3.14159"), types.FloatType), '.14159' : (float (".14159"), types.FloatType), '-.14159' : (float ("-.14159"), types.FloatType), '"1"' : ("1", types.StringType), "DADGAD" : ("DADGAD", types.StringType), "" : ("", types.StringType), '1,300' : ("1,300", types.StringType), # locale? '.' : (".", types.StringType), # locale? '+.' : ("+.", types.StringType), # locale? '-.' : ("-.", types.StringType), # locale? '+' : ("+", types.StringType), # locale? '-' : ("-", types.StringType), # locale?
|
def testTypedValueInterpretation (self): corrects = { 'TRUE' : (True, types.BooleanType), 'tRuE' : (True, types.BooleanType), 't' : (True, types.BooleanType), 'T' : (True, types.BooleanType), 'f' : (False, types.BooleanType), 'false' : (False, types.BooleanType), '1' : (1, types.IntType), '+1' : (1, types.IntType), '-1' : (-1, types.IntType), '0' : (0, types.IntType), '+0' : (0, types.IntType), '-0' : (0, types.IntType), '123456789' : (123456789, types.IntType), '-987654321' : (-987654321, types.IntType), '011' : (11, types.IntType), '-011' : (-11, types.IntType), '3.14159' : (float ("3.14159"), types.FloatType), '-3.14159' : (float ("-3.14159"), types.FloatType), '.14159' : (float (".14159"), types.FloatType), '-.14159' : (float ("-.14159"), types.FloatType), '"1"' : ("1", types.StringType), "DADGAD" : ("DADGAD", types.StringType), "" : ("", types.StringType), '1,300' : ("1,300", types.StringType), # locale? '.' : (".", types.StringType), # locale? '+.' : ("+.", types.StringType), # locale? '-.' : ("-.", types.StringType), # locale? '+' : ("+", types.StringType), # locale? '-' : ("-", types.StringType), # locale?
| 471,942
|
def __init__ (self): self.buffer = []
|
def __init__(self): self.buffer = []
| 471,943
|
def write (self, msg): self.buffer.append (msg)
|
def write (self, msg): self.buffer.append (msg)
| 471,944
|
def specify_DADGAD (mode, host): if mode == 'about': return ('-a', 'DADGAD') elif mode == 'id': return ('-i', id ('DADGAD', host)) elif mode == 'query': return ('-q', 'fluiddb/about="DADGAD"') else: raise ModeError, 'Bad mode'
|
def specify_DADGAD(mode, host): if mode == 'about': return ('-a', 'DADGAD') elif mode == 'id': return ('-i', id ('DADGAD', host)) elif mode == 'query': return ('-q', 'fluiddb/about="DADGAD"') else: raise ModeError, 'Bad mode'
| 471,945
|
def specify_DADGAD (mode, host): if mode == 'about': return ('-a', 'DADGAD') elif mode == 'id': return ('-i', id ('DADGAD', host)) elif mode == 'query': return ('-q', 'fluiddb/about="DADGAD"') else: raise ModeError, 'Bad mode'
|
def specify_DADGAD (mode, host): if mode == 'about': return ('-a', 'DADGAD') elif mode == 'id': return ('-i', id ('DADGAD', host)) elif mode == 'query': return ('-q', 'fluiddb/about="DADGAD"') else: raise ModeError, 'Bad mode'
| 471,946
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) self.stdout = sys.stdout self.stderr = sys.stderr self.stealOutput ()
|
def setUp(self): self.db.set_connection_from_global() self.db.set_debug_timeout(5.0) self.dadgadID = id('DADGAD', self.db.host) self.stdout = sys.stdout self.stderr = sys.stderr self.stealOutput ()
| 471,947
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) self.stdout = sys.stdout self.stderr = sys.stderr self.stealOutput ()
|
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) self.stdout = sys.stdout self.stderr = sys.stderr self.stealOutput ()
| 471,948
|
def reset (self): sys.stdout = self.stdout sys.stderr = self.stderr
|
def reset(self): sys.stdout = self.stdout sys.stderr = self.stderr
| 471,949
|
def Print (self, msg): self.stdout.write (str (msg) + '\n')
|
def Print (self, msg): self.stdout.write (str (msg) + '\n')
| 471,950
|
def testOutputManipulation (self): print 'one' sys.stderr.write ('two') self.reset () self.assertEqual (self.out.buffer, ['one', '\n']) self.assertEqual (self.err.buffer, ['two'])
|
def testOutputManipulation (self): print 'one' sys.stderr.write ('two') self.reset () self.assertEqual (self.out.buffer, ['one', '\n']) self.assertEqual (self.err.buffer, ['two'])
| 471,951
|
def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['tag'] + flags + [spec, 'rating=10'] + hostname execute_command_line(*parse_args(args)) self.reset () if verbose: target = ['Tagged object %s with rating = 10' % description, '\n'] else: if mode == 'query': target = ['1 object matched', '\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
|
def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['tag'] + flags + [spec, 'rating=10'] + hostname execute_command_line(*parse_args(args)) self.reset() if verbose: target = ['Tagged object %s with rating = 10' % description, '\n'] else: if mode == 'query': target = ['1 object matched', '\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
| 471,952
|
def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['tag'] + flags + [spec, 'rating=10'] + hostname execute_command_line(*parse_args(args)) self.reset () if verbose: target = ['Tagged object %s with rating = 10' % description, '\n'] else: if mode == 'query': target = ['1 object matched', '\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
|
def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['tag'] + flags + [spec, 'rating=10'] + hostname execute_command_line(*parse_args(args)) self.reset () if verbose: target = ['Tagged object %s with rating = 10' % description, '\n'] else: if mode == 'query': target = ['1 object matched', '\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
| 471,953
|
def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['untag'] + flags + [spec, 'rating'] + hostname execute_command_line(*parse_args(args)) self.reset () if verbose: target = ['Removed tag rating from object %s\n' % description,'\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
|
def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['untag'] + flags + [spec, 'rating'] + hostname execute_command_line(*parse_args(args)) self.reset() if verbose: target = ['Removed tag rating from object %s\n' % description,'\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
| 471,954
|
def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['untag'] + flags + [spec, 'rating'] + hostname execute_command_line(*parse_args(args)) self.reset () if verbose: target = ['Removed tag rating from object %s\n' % description,'\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
|
def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['untag'] + flags + [spec, 'rating'] + hostname execute_command_line(*parse_args(args)) self.reset () if verbose: target = ['Removed tag rating from object %s\n' % description,'\n'] else: target = [] self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, [])
| 471,955
|
def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' /%s/rating = 10' % self.user, '\n', ' /fluiddb/about = "DADGAD"', '\n']) self.assertEqual (self.err.buffer, [])
|
def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset() self.assertEqual(self.out.buffer, ['Object %s:' % description, '\n', ' /%s/rating = 10' % self.user, '\n', ' /fluiddb/about = "DADGAD"', '\n']) self.assertEqual (self.err.buffer, [])
| 471,956
|
def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' /%s/rating = 10' % self.user, '\n', ' /fluiddb/about = "DADGAD"', '\n']) self.assertEqual (self.err.buffer, [])
|
def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' /%s/rating = 10' % self.user, '\n', ' /fluiddb/about = "DADGAD"', '\n']) self.assertEqual (self.err.buffer, [])
| 471,957
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset() user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
| 471,958
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual(self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
| 471,959
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
| 471,960
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
|
def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset () user = self.db.credentials.username self.assertEqual (self.out.buffer, ['Object %s:' % description, '\n', ' %s' % cli_bracket ('tag /%s/rating not present' % user),
| 471,961
|
def frag_ranking(): global db_conn print """\ <a name="#3"><h2>Frag-based ranking</h2></a> <ol>\
|
def frag_ranking(): global db_conn print """\ <a name="#3"><h2>Frag-based ranking</h2></a> <ol>\
| 471,962
|
def fdratio_ranking(): global db_conn print """\ <a name="#4"><h2>Frag/death ratio-based ranking</h2></a> <ol>\
|
def fdratio_ranking(): global db_conn print """\ <a name="#4"><h2>Frag/death ratio-based ranking</h2></a> <ol>\
| 471,963
|
def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\
|
def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\
| 471,964
|
def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\
|
def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\
| 471,965
|
def fdratio_ranking(): global db_conn print """\ <a name="#4"><h2>Frag/death ratio-based ranking</h2></a> <ol>\
|
def fdratio_ranking(): global db_conn print """\ <a name="#4"><h2>Frag/death ratio-based ranking</h2></a> <ol>\
| 471,966
|
def presence_ranking(): global db_conn print """\ <a name="5"><h2>Presence-based ranking</h2></a> <ol>\
|
def presence_ranking(): global db_conn print """\ <a name="5"><h2>Presence-based ranking</h2></a> <ol>\
| 471,967
|
def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\
|
def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\
| 471,968
|
def parse_log(logpath): global db_conn idd = {} logf = open(logpath, 'r') while 1: logline = logf.readline() if (not logline): break m = frag_prog.match(logline) if (m): # Update the frags table db_conn.execute( '''insert into frags values (?, ?, ?)''', (m.group(1), m.group(2), m.group(3))) continue m = playerjoins_prog.match(logline) if (m): if (m.group(3) not in idd): playerinfos = re.split(r"\\", m.group(4)) playername = playerinfos[playerinfos.index('name')+1] time = int(m.group(1))*60 + int(m.group(2)) # Update the players id dictionary idd[m.group(3)] = playername # And the player games table db_conn.execute( '''insert into games values (?, ?, -1)''', (playername, time)) continue m = playerquits_prog.match(logline) if (m): time = int(m.group(1))*60 + int(m.group(2)) # Update the games table db_conn.execute( '''update games set stop=? where player = ? and stop = -1''', (time, idd[m.group(3)])) # And the players id dictionary del idd[m.group(3)] continue m = endgame_prog.match(logline) if (m): time = int(m.group(1))*60 + int(m.group(2)) # New game, make everybody quits for k,v in idd.iteritems(): db_conn.execute( '''update games set stop=? where player = ? and stop = -1''', (time, v)) pass idd = {} continue m = item_prog.match(logline) if (m): if( m.group(2) == "team_CTF_redflag" or m.group(2) == "team_CTF_blueflag" ): db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "CATCH")) pass continue m = flag_prog.match(logline) if (m): if int(m.group(2)) == 0 : db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "DROP")) pass elif int(m.group(2)) == 1 : db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "RETURN")) pass elif int(m.group(2)) == 2 : db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "CAPTURE")) pass continue db_conn.commit() logf.close()
|
def parse_log(logpath): global db_conn idd = {} logf = open(logpath, 'r') while 1: logline = logf.readline() if (not logline): break m = frag_prog.match(logline) if (m): # Update the frags table db_conn.execute( '''insert into frags values (?, ?, ?)''', (m.group(1), m.group(2), m.group(3))) continue m = playerjoins_prog.match(logline) if (m): if (m.group(3) not in idd): playerinfos = re.split(r"\\", m.group(4)) playername = playerinfos[playerinfos.index('name')+1] time = int(m.group(1))*60 + int(m.group(2)) # Update the players id dictionary idd[m.group(3)] = playername # And the player games table db_conn.execute( '''insert into games values (?, ?, -1)''', (playername, time)) continue m = playerquits_prog.match(logline) if (m): time = int(m.group(1))*60 + int(m.group(2)) # Update the games table db_conn.execute( '''update games set stop=? where player = ? and stop = -1''', (time, idd[m.group(3)])) # And the players id dictionary del idd[m.group(3)] continue m = endgame_prog.match(logline) if (m): time = int(m.group(1))*60 + int(m.group(2)) # New game, make everybody quits for k,v in idd.iteritems(): db_conn.execute( '''update games set stop=? where player = ? and stop = -1''', (time, v)) pass idd = {} continue m = item_prog.match(logline) if (m): if( m.group(2) == "team_CTF_redflag" or m.group(2) == "team_CTF_blueflag" ): db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "CATCH")) pass continue m = flag_prog.match(logline) if (m): if int(m.group(2)) == 0 : db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "DROP")) pass elif int(m.group(2)) == 1 : db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "RETURN")) pass elif int(m.group(2)) == 2 : db_conn.execute( '''insert into flags values (?, ?)''', (idd[m.group(1)], "CAPTURE")) pass continue db_conn.commit() logf.close()
| 471,969
|
def getContent(self): """Open content as a stream for reading. See DAVResource.getContent() """ assert not self.isCollection mime = self.getContentType() if mime.startswith("text"): return file(self._filePath, "r", BUFFER_SIZE) return file(self._filePath, "rb", BUFFER_SIZE)
|
def getContent(self): """Open content as a stream for reading. See DAVResource.getContent() """ assert not self.isCollection return file(self._filePath, "rb", BUFFER_SIZE)
| 471,970
|
def copy(self, source, destination, body=None, depth='infinity', overwrite=True, headers=None): """Copy DAV resource""" # Set all proper headers if headers is None: headers = {'Destination':destination} else: headers['Destination'] = self._url.geturl() + destination if overwrite is False: headers['Overwrite'] = 'F' headers['Depth'] = depth self._request('COPY', source, body=body, headers=headers)
|
defcopy(self,source,destination,body=None,depth='infinity',overwrite=True,headers=None):"""CopyDAVresource"""#SetallproperheadersifheadersisNone:headers={'Destination':destination}else:headers['Destination']=self._url.geturl()+destinationifoverwriteisFalse:headers['Overwrite']='F'headers['Depth']=depthself._request('COPY',source,body=body,headers=headers)
| 471,971
|
def copy_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Copy DAV collection""" body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None: headers = {} headers['Content-Type'] = 'text/xml; charset="utf-8"' self.copy(source, destination, body=unicode(body, 'utf-8'), depth=depth, overwrite=overwrite, headers=headers)
|
def copy_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Copy DAV collection. Note: support for the 'propertybehavior' request body for COPY and MOVE has been removed with RFC4918 """ body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None: headers = {} headers['Content-Type'] = 'text/xml; charset="utf-8"' self.copy(source, destination, body=unicode(body, 'utf-8'), depth=depth, overwrite=overwrite, headers=headers)
| 471,972
|
def move_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Move DAV collection and copy all properties""" body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None: headers = {} headers['Content-Type'] = 'text/xml; charset="utf-8"'
|
def move_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Move DAV collection and copy all properties. Note: support for the 'propertybehavior' request body for COPY and MOVE has been removed with RFC4918 """ body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None: headers = {} headers['Content-Type'] = 'text/xml; charset="utf-8"'
| 471,973
|
def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubElement(root, '{DAV:}set')
|
def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubElement(root, '{DAV:}set')
| 471,974
|
def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubElement(root, '{DAV:}set')
|
def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubElement(root, '{DAV:}set')
| 471,975
|
def refresh(self, locktoken, timeout=None): """Set new timeout for lock, if existing and valid.""" if timeout is None: timeout = LockManager.LOCK_TIME_OUT_DEFAULT self._lock.acquireWrite() try: lock = self.getLock(locktoken) _logger.debug("refresh %s" % _lockString(lock)) if lock: lock["timeout"] = time.time() + timeout self._dict[locktoken] = lock self._sync() return lock finally: self._lock.release()
|
def refresh(self, locktoken, timeout=None): """Set new timeout for lock, if existing and valid.""" if timeout is None: timeout = LockManager.LOCK_TIME_OUT_DEFAULT self._lock.acquireWrite() try: lock = self.getLock(locktoken) _logger.debug("refresh %s" % _lockString(lock)) if lock: if timeout < 0: lock["timeout"] = -1 else: lock["timeout"] = time.time() + timeout self._dict[locktoken] = lock self._sync() return lock finally: self._lock.release()
| 471,976
|
def getIndirectUrlLockList(self, url, username=None): """Return a list of valid lockDicts, that protect <url> directly or indirectly. If a username is given, only locks owned by this principal are returned. Side effect: expired locks for this url and all parents are purged. """ self._lock.acquireRead() try: lockList = [] u = url while u: # TODO: check, if expired ll = self.getUrlLockList(u) for l in ll: if u != url and l["depth"] != "infinity": continue # We only consider parents with Depth: infinity # TODO: handle shared locks in some way?
|
defgetIndirectUrlLockList(self,url,username=None):"""ReturnalistofvalidlockDicts,thatprotect<url>directlyorindirectly.Ifausernameisgiven,onlylocksownedbythisprincipalarereturned.Sideeffect:expiredlocksforthisurlandallparentsarepurged."""self._lock.acquireRead()try:lockList=[]u=urlwhileu:#TODO:check,ifexpiredll=self.getUrlLockList(u)forlinll:ifu!=urlandl["depth"]!="infinity":continue#WeonlyconsiderparentswithDepth:infinity#TODO:handlesharedlocksinsomeway?
| 471,977
|
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "wsgi.multithread": 1, "wsgi.multiprocess": 0, "wsgi.run_once": 0, "REQUEST_METHOD": self.command, "SCRIPT_NAME": scriptName, "PATH_INFO": pathInfo, "QUERY_STRING": query, "CONTENT_TYPE": self.headers.get("Content-Type", ""), "CONTENT_LENGTH": self.headers.get("Content-Length", ""), "REMOTE_ADDR": self.client_address[0], "SERVER_NAME": self.server.server_address[0], "SERVER_PORT": str(self.server.server_address[1]), "SERVER_PROTOCOL": self.request_version, } for httpHeader, httpValue in self.headers.items(): if not httpHeader.lower() in ("content-type", "content-length"): env ["HTTP_%s" % httpHeader.replace ("-", "_").upper()] = httpValue
|
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "wsgi.multithread": 1, "wsgi.multiprocess": 0, "wsgi.run_once": 0, "REQUEST_METHOD": self.command, "SCRIPT_NAME": scriptName, "PATH_INFO": pathInfo, "QUERY_STRING": query, "CONTENT_TYPE": self.headers.get("Content-Type", ""), "CONTENT_LENGTH": self.headers.get("Content-Length", ""), "REMOTE_ADDR": self.client_address[0], "SERVER_NAME": self.server.server_address[0], "SERVER_PORT": str(self.server.server_address[1]), "SERVER_PROTOCOL": self.request_version, } for httpHeader, httpValue in self.headers.items(): if not httpHeader.lower() in ("content-type", "content-length"): env ["HTTP_%s" % httpHeader.replace ("-", "_").upper()] = httpValue
| 471,978
|
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "wsgi.multithread": 1, "wsgi.multiprocess": 0, "wsgi.run_once": 0, "REQUEST_METHOD": self.command, "SCRIPT_NAME": scriptName, "PATH_INFO": pathInfo, "QUERY_STRING": query, "CONTENT_TYPE": self.headers.get("Content-Type", ""), "CONTENT_LENGTH": self.headers.get("Content-Length", ""), "REMOTE_ADDR": self.client_address[0], "SERVER_NAME": self.server.server_address[0], "SERVER_PORT": str(self.server.server_address[1]), "SERVER_PROTOCOL": self.request_version, } for httpHeader, httpValue in self.headers.items(): if not httpHeader.lower() in ("content-type", "content-length"): env ["HTTP_%s" % httpHeader.replace ("-", "_").upper()] = httpValue
|
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "wsgi.multithread": 1, "wsgi.multiprocess": 0, "wsgi.run_once": 0, "REQUEST_METHOD": self.command, "SCRIPT_NAME": scriptName, "PATH_INFO": pathInfo, "QUERY_STRING": query, "CONTENT_TYPE": self.headers.get("Content-Type", ""), "CONTENT_LENGTH": self.headers.get("Content-Length", ""), "REMOTE_ADDR": self.client_address[0], "SERVER_NAME": self.server.server_address[0], "SERVER_PORT": str(self.server.server_address[1]), "SERVER_PROTOCOL": self.request_version, } for httpHeader, httpValue in self.headers.items(): if not httpHeader.lower() in ("content-type", "content-length"): env ["HTTP_%s" % httpHeader.replace ("-", "_").upper()] = httpValue
| 471,979
|
def do_SHUTDOWN (self): """Send 200 OK response, and set server.stop to True. http://code.activestate.com/recipes/336012/ """ print "got SHUTDOWN" self.send_response(200) self.end_headers() self.server.stop = True
|
def do_SHUTDOWN (self): """Send 200 OK response, and set server.stop to True. http://code.activestate.com/recipes/336012/ """ print "got SHUTDOWN" self.send_response(200) self.end_headers() self.server.stop = True
| 471,980
|
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "wsgi.multithread": 1, "wsgi.multiprocess": 0, "wsgi.run_once": 0,
|
defrunWSGIApp(self,application,scriptName,pathInfo,query):logging.info("RunningapplicationwithSCRIPT_NAME%sPATH_INFO%s"%(scriptName,pathInfo))ifself.command=="PUT":pass#breakpointenv={"wsgi.version":(1,0),"wsgi.url_scheme":"http","wsgi.input":self.rfile,"wsgi.errors":sys.stderr,"wsgi.multithread":1,"wsgi.multiprocess":0,"wsgi.run_once":0,
| 471,981
|
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "wsgi.multithread": 1, "wsgi.multiprocess": 0, "wsgi.run_once": 0,
|
defrunWSGIApp(self,application,scriptName,pathInfo,query):logging.info("RunningapplicationwithSCRIPT_NAME%sPATH_INFO%s"%(scriptName,pathInfo))ifself.command=="PUT":pass#breakpointenv={"wsgi.version":(1,0),"wsgi.url_scheme":"http","wsgi.input":self.rfile,"wsgi.errors":sys.stderr,"wsgi.multithread":1,"wsgi.multiprocess":0,"wsgi.run_once":0,
| 471,982
|
def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address
|
def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop_request"), "serve_forever_stoppable() must be called before" assert not self.stop_request, "stop_serve_forever() must only be called once" self.stop_request = True time.sleep(.01) if self.stopped: return def _shutdownHandler(self): """Send 200 OK response, and set server.stop_request to True. http://code.activestate.com/recipes/336012/ """ self.send_response(200) self.end_headers() self.server.stop_request = True if not hasattr(ExtHandler, "do_SHUTDOWN"): setattr(ExtHandler, "do_SHUTDOWN", _shutdownHandler) (host, port) = self.server_address
| 471,983
|
def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address
|
def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address
| 471,984
|
def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address
|
def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address
| 471,985
|
def serve_forever_stoppable(self): """Handle one request at a time until stop_serve_forever(). http://code.activestate.com/recipes/336012/ """ self.stop = False while not self.stop: self.handle_request() print "serve_forever_stoppable received stop request"
|
def serve_forever_stoppable(self): """Handle one request at a time until stop_serve_forever(). http://code.activestate.com/recipes/336012/ """ self.stop_request = False self.stopped = False while not self.stop_request: self.handle_request() print "serve_forever_stoppable received stop request"
| 471,986
|
def serve_forever_stoppable(self): """Handle one request at a time until stop_serve_forever(). http://code.activestate.com/recipes/336012/ """ self.stop = False while not self.stop: self.handle_request() print "serve_forever_stoppable received stop request"
|
def serve_forever_stoppable(self): """Handle one request at a time until stop_serve_forever(). http://code.activestate.com/recipes/336012/ """ self.stop = False while not self.stop: self.handle_request() print "serve_forever_stoppable received stop request"
| 471,987
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
| 471,988
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
| 471,989
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
| 471,990
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
| 471,991
|
def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubElement(root, '{DAV:}set') object_to_etree(prop_set, set_props, namespace=namespace) if remove_props is not None: prop_remove = ElementTree.SubElement(root, '{DAV:}remove') object_to_etree(prop_remove, remove_props, namespace=namespace) tree = ElementTree.ElementTree(root) # Add proper headers if headers is None: headers = {} headers['Content-Type'] = 'text/xml; charset="utf-8"' self._request('PROPPATCH', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers)
|
def body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body proppatch(self, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body path, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body set_props=None, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body remove_props=None, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body namespace='DAV:', body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body headers=None): body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body """Patch body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body properties body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body on body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body a body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body DAV body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body resource. body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body If body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body namespace body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body is body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body not body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body specified body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body the body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body DAV body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body namespace body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body is body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body used body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body for body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body all body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body properties""" body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body root body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body = body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body ElementTree.Element('{DAV:}propertyupdate') body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body if body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body set_props body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body is body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body not body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body None: body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body prop_set body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body = body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body ElementTree.SubElement(root, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body '{DAV:}set') body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body object_to_etree(prop_set, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body set_props, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body namespace=namespace) body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body if body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body remove_props body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body is body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body not body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body None: body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body prop_remove body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body = body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body ElementTree.SubElement(root, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body '{DAV:}remove') body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body object_to_etree(prop_remove, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body remove_props, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body namespace=namespace) body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body tree body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body = body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body ElementTree.ElementTree(root) body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body # body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body Add body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body proper body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body headers body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body if body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body headers body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body is body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body None: body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body headers body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body = body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body {} body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body headers['Content-Type'] body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body = body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body 'text/xml; body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body charset="utf-8"' body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body self._request('PROPPATCH', body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body path, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body body=unicode('<?xml body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body version="1.0" body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body encoding="utf-8" body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body ?>\n'+body, body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body 'utf-8'), body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body headers=headers) body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body
| 471,992
|
def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): """Set a lock on a dav resource""" root = ElementTree.Element('{DAV:}lockinfo') object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') tree = ElementTree.ElementTree(root) # Add proper headers if headers is None: headers = {} if depth is not None: headers['Depth'] = depth headers['Content-Type'] = 'text/xml; charset="utf-8"' headers['Timeout'] = 'Infinite, Second-4100000000' self._request('LOCK', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) locks = self.response.etree.finall('.//{DAV:}locktoken') lock_list = [] for lock in locks: lock_list.append(lock.getchildren()[0].text.strip().strip('\n')) return lock_list
|
def set_lock(self, path, owner, locktype='write', lockscope='exclusive', depth=None, headers=None): """Set a lock on a dav resource""" root = ElementTree.Element('{DAV:}lockinfo') object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') tree = ElementTree.ElementTree(root) # Add proper headers if headers is None: headers = {} if depth is not None: headers['Depth'] = depth headers['Content-Type'] = 'text/xml; charset="utf-8"' headers['Timeout'] = 'Infinite, Second-4100000000' self._request('LOCK', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) locks = self.response.etree.finall('.//{DAV:}locktoken') lock_list = [] for lock in locks: lock_list.append(lock.getchildren()[0].text.strip().strip('\n')) return lock_list
| 471,993
|
def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): """Set a lock on a dav resource""" root = ElementTree.Element('{DAV:}lockinfo') object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') tree = ElementTree.ElementTree(root) # Add proper headers if headers is None: headers = {} if depth is not None: headers['Depth'] = depth headers['Content-Type'] = 'text/xml; charset="utf-8"' headers['Timeout'] = 'Infinite, Second-4100000000' self._request('LOCK', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) locks = self.response.etree.finall('.//{DAV:}locktoken') lock_list = [] for lock in locks: lock_list.append(lock.getchildren()[0].text.strip().strip('\n')) return lock_list
|
def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): """Set a lock on a dav resource""" root = ElementTree.Element('{DAV:}lockinfo') object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') tree = ElementTree.ElementTree(root) # Add proper headers if headers is None: headers = {} if depth is not None: headers['Depth'] = depth headers['Content-Type'] = 'text/xml; charset="utf-8"' headers['Timeout'] = 'Infinite, Second-4100000000' self._request('LOCK', path, body=unicode('<?xml version="1.0" encoding="utf-8" ?>\n'+body, 'utf-8'), headers=headers) locks = self.response.tree.findall('.//{DAV:}locktoken') lock_list = [] for lock in locks: lock_list.append(lock.getchildren()[0].text.strip().strip('\n')) return lock_list
| 471,994
|
def unlock(self, path, token, headers=None): """Unlock DAV resource with token""" if headers is None: headers = {} headers['Lock-Tocken'] = '<%s>' % token self._request('UNLOCK', path, body=None, headers=headers)
|
def unlock(self, path, token, headers=None): """Unlock DAV resource with token""" if headers is None: headers = {} headers['Lock-Token'] = '<%s>' % token self._request('UNLOCK', path, body=None, headers=headers)
| 471,995
|
def unlock(self, path, token, headers=None): """Unlock DAV resource with token""" if headers is None: headers = {} headers['Lock-Tocken'] = '<%s>' % token self._request('UNLOCK', path, body=None, headers=headers)
|
def unlock(self, path, token, headers=None): """Unlock DAV resource with token""" if headers is None: headers = {} headers['Lock-Tocken'] = '<%s>' % token self._request('UNLOCK', path, body=None, headers=headers)
| 471,996
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
|
def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None
| 471,997
|
def _checkWritePermission(self, res, depth, environ): """Check, if write access is allowed, otherwise raise DAVError.""" lockMan = self._davProvider.lockManager if lockMan is None or res is None: return True
|
def _checkWritePermission(self, res, depth, environ): """Raise DAVError(HTTP_LOCKED), if res is locked. If depth=='infinity', we also raise when child resources are locked. """ lockMan = self._davProvider.lockManager if lockMan is None or res is None: return True
| 471,998
|
def doPROPPATCH(self, environ, start_response): """Handle PROPPATCH request to set or remove a property. @see http://www.webdav.org/specs/rfc4918.html#METHOD_PROPPATCH """ path = environ["PATH_INFO"] res = self._davProvider.getResourceInst(path, environ)
|
defdoPROPPATCH(self,environ,start_response):"""HandlePROPPATCHrequesttosetorremoveaproperty.@seehttp://www.webdav.org/specs/rfc4918.html#METHOD_PROPPATCH"""path=environ["PATH_INFO"]res=self._davProvider.getResourceInst(path,environ)
| 471,999
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.