def add_publication(self, publish_request, commiter=None):
        logger.debug("--------------Requested publication---------\n %s" % repr(publish_request))

        current_time = len(self._deltas)
        delta = BlockDelta(publish_request.msg, publish_request.tag,
                           versiontag=publish_request.versiontag, date=time.time(),
                           origin=publish_request.origin,
                           commiter=commiter)

        # Check outdated
        target_time = publish_request.parent.time
        if target_time != current_time - 1:
            raise PublishException("Block %s outdated: %d < %d"
                                   % (publish_request.block_name, target_time, current_time - 1))

        # Promoting tag
        if not publish_request:
            if current_time > 0:
                old_delta = self._deltas[-1]
                if old_delta.tag < publish_request.tag:
                    self._deltas[-1] = delta
                    return [], [], [], []
            raise PublishException('Up to date, nothing to publish')

        # Handling dev
        if (current_time > 0 and self._deltas[1 - current_time].tag == DEV):
            if publish_request.parent_time != self._deltas[-1].date:
                raise PublishException("Concurrent modification, cannot publish, check diff and "
                                       "try again")
            current_time = current_time - 1
            self._deltas[-1] = delta
        else:
            self._deltas.append(delta)

        # DepTable
        self._deps_table.pop_dev(current_time)
        _, old_table = self._deps_table.last()
        if old_table != publish_request.deptable:
            self._deps_table.append(current_time, publish_request.deptable)

        contents = []
        cells = []
        dev_cell_ids = []
        dev_content_ids = []

        for name in publish_request.deleted:
            self._cells_table.delete(name, current_time)
            try:
                self._contents_table.delete(name, current_time)
            except KeyError:
                pass  # It was virtual

        for cell in publish_request.cells:
            old_id = self._cells_table.pop_dev(cell.name.cell_name, current_time)
            if old_id is not None:
                old_id = self._numeric_id + old_id[0]
                dev_cell_ids.append(old_id)

            id_ = self._numeric_id + self._cell_count
            self._cell_count += 1
            cell.ID = id_
            cells.append(cell)
            self._cells_table.create(cell.name.cell_name, cell.ID, current_time)

        for name, content in publish_request.contents.iteritems():
            old_id = self._contents_table.pop_dev(name, current_time)
            if old_id is not None:
                old_id = self._numeric_id + old_id[0]
                dev_content_ids.append(old_id)

            if content is not None:
                id_ = self._numeric_id + self._content_count
                self._content_count += 1
                content.ID = id_
                contents.append(content)
                self._contents_table.create(name, content.ID, current_time)
            else:
                self._contents_table.delete(name, current_time)  # Has become virtual

        for name, content_id in publish_request.contents_ids.iteritems():
            self._contents_table.create(name, content_id, current_time)

        # Renames
        self._renames.pop_dev(current_time)
        if publish_request.renames:
            self._renames.append(current_time, publish_request.renames)

        return (cells, contents, dev_cell_ids, dev_content_ids)
dataset/ETHPy150Open biicode/bii-server/model/block.py/Block.add_publication/swapped operands of `-`