Exemple #1
0
def writeArticle(doc_id, _base64_content):
    """

    >>> doc_id = '0706012057'
    >>> _base64_content = '열라 테스트'
    >>> #ma = MuseArticle('1201170413')    
    >>> #ma.html
    >>> #dd = writeArticle('1201170413', ma.html)
    >>> #dd
    >>> #dd = writeArticle(doc_id, _base64_content)
    >>> #dd.read()
    >>> #'\\nOK\\n'

    """
    data = Data()
    data.cmd = "writeArticle"
    data.doc_id = doc_id
    data._base64_content = _base64_content

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()

    return result
Exemple #2
0
def updateServerFile(filename, _base64_content):
    """
    Client side function for the updateServer api.
    """
    data = Data()
    data.cmd = "updateServerFile"
    data.filename = filename
    data._base64_content = _base64_content

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result
Exemple #3
0
def updateFile(filename, _base64_content):
    '''
    Update files to the server. The file to be stored into config.files_d.
    '''
    data = Data()
    data.cmd = "updateFile"
    data.filename = filename
    data._base64_content = _base64_content

    # The server api will not replace the file. Returns False when The
    # file is exists in the server.
    api = API(data)
    fd = api.send()
    result = fd.read()
    return result
Exemple #4
0
def deleteComment(doc_id, comment_id):
    """
    deleteComment("0706012057", "26")
    """
    #libs.log(doc_id)
    #libs.log(comment_id)
    data = Data()
    data.cmd = "deleteComment"
    data.doc_id = doc_id
    data.comment_id = comment_id

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result
Exemple #5
0
def updateIndex(doc_id, _jsonBase64_dict):
    """

    >>> doc_id = '0706012057'
    >>> _jsonBase64_dict = {'category': 'emacs planner', 'date': '1108170951', 'author': 'this is author', 'update': '1108170952', 'title': '가나다 우리는 사는 사람들 이 닫 다다. fjdksf kdsf ', 'doc_id': '0706012057'}
    >>> #dd = updateIndex(doc_id, _jsonBase64_dict)
    >>> #dd.read()
    >>> #'\\nOK\\n'
    """

    data = Data()
    data.cmd = "updateIndex"
    data.doc_id = doc_id
    data._jsonBase64_dict = _jsonBase64_dict

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result
Exemple #6
0
def writeComment(doc_id, _base64_content, _base64_name='', password=''):
    """
    >>> doc_id = '0706012057'
    >>> _base64_content = '어찌하다가 우리가 이런일에\\n 아'
    >>> _base64_name = '달수'
    >>> password = '******'
    >>> #dd = writeComment(doc_id, _base64_content, _base64_name, password)
    >>> #dd.read()
    >>> #'\\nOK\\n' # This is output
    """
    data = Data()
    data.cmd = "writeComment"
    data.doc_id = doc_id
    data._base64_content = _base64_content
    data._base64_name = _base64_name
    data.password = password

    api = API(data)
    fd = api.send()
    result = fd.read()
    fd.close()
    return result