コード例 #1
0
ファイル: views.py プロジェクト: zniper/rhaptos2.user
def get_user_by_identifier():
    """
example::

      /user?user=org.cnx.user.f9647df6-cc6e-4885-9b53-254aa55a3383

    .. todo:: Flask will unquote the whole URL and try to route that,
              instead of taking the route that exists in quoted format,
               and then calculating the <parameter>

              /openid/this/is/a/path

              /openid/http://this/is/openid/url

              /openid/'http%3A%2F%2Fthis%2Fis%2Fopenid%2Furl'

              Flask should handle the last differently.

    originally this use <idenfitfier> to pluckjt eh id from a path.

    """
    qstr = request.query_string
    unquoted_identifier = qstr.replace("user="******"")
    unquoted_identifier = urllib.unquote(unquoted_identifier)
    dolog("INFO", "I saw identifier: %s" % unquoted_identifier)

    try:
        userobj = usermodel.get_user_by_identifier(unquoted_identifier)
        dolog("INFO", "%s <- userobj from get by identifer" % str(userobj))
    except err.Rhaptos2Error, e:
        abort(404)
コード例 #2
0
ファイル: usermodel.py プロジェクト: jbarmash/rhaptos2.user
def put_user(jsond, user_id):
    """Given a user_id, and a json_str representing the "Updated" fields
       then update those fields for that user_id """

    try:
        uobj =get_user(user_id)
    except Exception, e:
        dolog("INFO", str(e))
        raise Rhaptos2Error("FAiled to get user")
コード例 #3
0
ファイル: views.py プロジェクト: zniper/rhaptos2.user
def vw_post_user():
    """ """


    js = request.json
    ### .. todo:: parse incvoming user dict
    dolog("INFO", "***" + repr(js) + str(type(js)))
    u = usermodel.post_user(js)
    return "Saved"
コード例 #4
0
ファイル: views.py プロジェクト: zniper/rhaptos2.user
def vw_put_user(user_id):
    """ """
    ###
    #session add etc here
    js = request.json
    dolog("INFO", "***PUT:" + repr(js) + str(type(js)))
    ### .. todo:: parse the posted / putted dict???
    try:
        u = usermodel.put_user(js, user_id)
    except:
        abort(401)#.. todo:: meaningful error messages to user please. Flash?
    return "Saved"
コード例 #5
0
ファイル: views.py プロジェクト: zniper/rhaptos2.user
def index():
    dolog("INFO", "THis is request %s" % g.requestid)
    return "This is the USer Database for CNX"