/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

  • Committer: Martin Pool
  • Date: 2011-05-20 14:46:02 UTC
  • mto: This revision was merged to the branch mainline in revision 5923.
  • Revision ID: mbp@canonical.com-20110520144602-bqli0t6dj01gl0pv
Various pyflakes import fixes.

Some modules were used for subclassing or at module load time, so there is no
point loading them lazily.

Some were not imported when they should be.

Show diffs side-by-side

added added

removed removed

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