~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/console/service.py

ivle.webapp.groups: Remove most of the view code; the template now accesses
    the objects directly. Also fix a few double-encodings and typos.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
import ivle.chat
34
34
import ivle.conf
35
35
from ivle.webapp.base.rest import JSONRESTView, named_operation
36
 
from ivle.webapp.errors import BadRequest
37
36
 
38
37
# XXX: Should be RPC view, with actions in URL?
39
38
class ConsoleServiceRESTView(JSONRESTView):
40
39
    '''An RPC interface to a Python console.'''
41
 
    def get_permissions(self, user):
42
 
        if user is not None:
43
 
            return set(['use'])
44
 
        else:
45
 
            return set()
46
 
 
47
 
    @named_operation('use')
 
40
    @named_operation
48
41
    def start(self, req, cwd=''):
49
42
        working_dir = os.path.join("/home", req.user.login, cwd)
50
43
 
59
52
                                     "port": cons.port,
60
53
                                     "magic": cons.magic}).encode('hex')}
61
54
 
62
 
    @named_operation('use')
 
55
    @named_operation
63
56
    def chat(self, req, key, text='', kind="chat"):
64
57
        # The request *should* have the following four fields:
65
58
        # key: Hex JSON dict of host and port where the console server lives,