Example #1
0
 def parse_and_update_worksheet(self, uuid, lines):
     """
     Replace worksheet |uuid| with the raw contents given by |lines|.
     """
     worksheet_info = self.client.get_worksheet_info(uuid, True)
     new_items, commands = worksheet_util.parse_worksheet_form(lines, self.client, worksheet_info['uuid'])
     self.client.update_worksheet_items(worksheet_info, new_items)
Example #2
0
 def parse_and_update_worksheet(self, uuid, lines):
     worksheet_info = self.client.get_worksheet_info(uuid, True)
     new_items, commands = worksheet_util.parse_worksheet_form(lines, self.client, worksheet_info['uuid'])
     self.client.update_worksheet(
                         worksheet_info,
                         new_items
                 )
Example #3
0
 def parse_and_update_worksheet(uuid, lines):
     """
     Replace worksheet |uuid| with the raw contents given by |lines|.
     """
     worksheet_info = get_worksheet_info(uuid, fetch_items=True, legacy=True)
     new_items, commands = worksheet_util.parse_worksheet_form(lines, local.model, request.user, worksheet_info['uuid'])
     update_worksheet_items(worksheet_info, new_items)
Example #4
0
 def parse_and_update_worksheet(self, uuid, lines):
     worksheet_info = self.client.get_worksheet_info(uuid, True)
     new_items, commands = worksheet_util.parse_worksheet_form(lines, self.client, worksheet_info['uuid'])
     self.client.update_worksheet_items(
                         worksheet_info,
                         new_items
                 )
Example #5
0
def update_worksheet_raw(uuid):
    lines = request.body.read().split(os.linesep)
    new_items, commands = worksheet_util.parse_worksheet_form(
        lines, local.model, request.user, uuid)
    worksheet_info = get_worksheet_info(uuid, fetch_items=True)
    update_worksheet_items(worksheet_info, new_items)
    return {'data': {'commands': commands}}
Example #6
0
 def do_add_command(self, argv, parser):
     parser.add_argument(
       'bundle_spec',
       help='identifier: [<uuid>|<name>]',
       nargs='?')
     parser.add_argument(
       'worksheet_spec',
       help='identifier: [<uuid>|<name>]',
       nargs='?',
     )
     parser.add_argument(
       '-m', '--message',
       help='add a text element',
       nargs='?',
     )
     args = parser.parse_args(argv)
     client = self.manager.current_client()
     if args.worksheet_spec:
         worksheet_info = client.worksheet_info(args.worksheet_spec)
     else:
         worksheet_info = self.get_current_worksheet_info()
         if not worksheet_info:
             raise UsageError('Specify a worksheet or switch to one with `cl work`.')
     if args.bundle_spec:
         client.add_worksheet_item(worksheet_info['uuid'], args.bundle_spec)
     if args.message:
         new_items = worksheet_util.get_current_items(worksheet_info) \
                   + worksheet_util.parse_worksheet_form([args.message])
         client.update_worksheet(worksheet_info, new_items)
Example #7
0
 def parse_and_update_worksheet(self, uuid, lines):
     """
     Replace worksheet |uuid| with the raw contents given by |lines|.
     """
     worksheet_info = self.client.get_worksheet_info(uuid, True)
     new_items, commands = worksheet_util.parse_worksheet_form(
         lines, self.client, worksheet_info['uuid'])
     self.client.update_worksheet_items(worksheet_info, new_items)
Example #8
0
def populate_worksheet(worksheet, name, title):
    file_path = os.path.join(
        os.path.dirname(os.path.realpath(__file__)), '../objects/' + name + '.ws'
    )
    lines = [line.rstrip() for line in open(file_path, 'r').readlines()]
    items = worksheet_util.parse_worksheet_form(lines, local.model, request.user, worksheet.uuid)
    info = get_worksheet_info(worksheet.uuid, fetch_items=True)
    update_worksheet_items(info, items)
    update_worksheet_metadata(worksheet.uuid, {'title': title})
Example #9
0
def update_worksheet_raw(uuid):
    """
    Request body contains the raw lines of the worksheet.
    """
    lines = decoded_body().split(os.linesep)
    new_items = worksheet_util.parse_worksheet_form(lines, local.model, request.user, uuid)
    worksheet_info = get_worksheet_info(uuid, fetch_items=True)
    update_worksheet_items(worksheet_info, new_items)
    response.status = 204  # Success, No Content
Example #10
0
def populate_worksheet(worksheet, name, title):
    file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             '../objects/' + name + '.ws')
    lines = [line.rstrip() for line in open(file_path, 'r').readlines()]
    items = worksheet_util.parse_worksheet_form(lines, local.model,
                                                request.user, worksheet.uuid)
    info = get_worksheet_info(worksheet.uuid, fetch_items=True)
    update_worksheet_items(info, items)
    update_worksheet_metadata(worksheet.uuid, {'title': title})
def update_worksheet_raw(uuid):
    """
    Request body contains the raw lines of the worksheet.
    """
    lines = decoded_body().split(os.linesep)
    new_items = worksheet_util.parse_worksheet_form(lines, local.model, request.user, uuid)
    worksheet_info = get_worksheet_info(uuid, fetch_items=True)
    update_worksheet_items(worksheet_info, new_items)
    response.status = 204  # Success, No Content