~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-26 10:17:22 UTC
  • mfrom: (4985.1.5 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100126101722-y213sv39buw3dgi2
Implement TestCase.overrideAttr to simplify tests setUp/cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
31
31
# of a SmartServerRequest subclass.
32
32
 
33
33
 
 
34
import tempfile
 
35
import thread
34
36
import threading
35
37
 
36
38
from bzrlib import (
46
48
from bzrlib.lazy_import import lazy_import
47
49
lazy_import(globals(), """
48
50
from bzrlib.bundle import serializer
49
 
 
50
 
import tempfile
51
 
import thread
52
51
""")
53
52
 
54
53
 
135
134
        It will return a SmartServerResponse if the command does not expect a
136
135
        body.
137
136
 
138
 
        :param args: the arguments of the request.
 
137
        :param *args: the arguments of the request.
139
138
        """
140
139
        self._check_enabled()
141
140
        return self.do(*args)
447
446
        return ('TokenMismatch', err.given_token, err.lock_token)
448
447
    elif isinstance(err, errors.LockContention):
449
448
        return ('LockContention',)
450
 
    elif isinstance(err, MemoryError):
451
 
        # GZ 2011-02-24: Copy bzrlib.trace -Dmem_dump functionality here?
452
 
        return ('MemoryError',)
453
449
    # Unserialisable error.  Log it, and return a generic error
454
450
    trace.log_exception_quietly()
455
 
    return ('error', trace._qualified_exception_name(err.__class__, True),
456
 
        str(err))
 
451
    return ('error', str(err))
457
452
 
458
453
 
459
454
class HelloRequest(SmartServerRequest):
506
501
    'Branch.set_tags_bytes', 'bzrlib.smart.branch',
507
502
    'SmartServerBranchSetTagsBytes')
508
503
request_handlers.register_lazy(
509
 
    'Branch.heads_to_fetch', 'bzrlib.smart.branch',
510
 
    'SmartServerBranchHeadsToFetch')
511
 
request_handlers.register_lazy(
512
504
    'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
513
505
request_handlers.register_lazy(
514
506
    'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
518
510
    'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
519
511
request_handlers.register_lazy( 'Branch.set_config_option',
520
512
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOption')
521
 
request_handlers.register_lazy( 'Branch.set_config_option_dict',
522
 
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOptionDict')
523
513
request_handlers.register_lazy( 'Branch.set_last_revision',
524
514
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision')
525
515
request_handlers.register_lazy(