コード例 #1
0
    def save_text(self, text):
        if not self.code_session:
            query_set = CodeSession.objects.filter(session_id=self.session_id)
            if query_set.exists():
                self.code_session = query_set[0]
            else:
                self.code_session = CodeSession()
                self.code_session.session_id = self.session_id

        self.text = text
        self.code_session.code = text
        self.code_session.save()
コード例 #2
0
class Session(object):
    sockets = []
    text = ""
    range = None
    top_row = 0
    code_session = None

    def __init__(self, session_id):
        self.session_id = session_id

    def save_text(self, text):
        if not self.code_session:
            query_set = CodeSession.objects.filter(session_id=self.session_id)
            if query_set.exists():
                self.code_session = query_set[0]
            else:
                self.code_session = CodeSession()
                self.code_session.session_id = self.session_id

        self.text = text
        self.code_session.code = text
        self.code_session.save()
コード例 #3
0
ファイル: views.py プロジェクト: mturilin/neji
def new(request):
    python_code = request.POST["python_code"]
    new_uuid = uuid.uuid1().hex

    logger.debug("Creating new code session, uuid=" + new_uuid)

    code_session = CodeSession()
    code_session.session_id = new_uuid
    code_session.code = python_code

    code_session.save()

    return HttpResponse(reverse("session", args=[new_uuid]))