Ejemplo n.º 1
0
def acceptedTerms(webin):
    pcn = json.loads(webin.content())
    vprint("acceptedTerms", pcn)
    utopic = pcn["user"]
    email = pcn["email"]
    user = models.loadUserD(utopic, webin.pageStore)
    if user == None:
        return failResponse("noSuchUser")
    rss = None
    if email:
        vcode = models.genId("register")
        user.validation_code = vcode
        user.validated = 0
        user.email = email
        vprint("sending validating email to ", email)
        rss = ses.sendValidationEmail(user, True)
    user.accepted_terms = 1
    user.dynsave(False)
    s = user.newSession()
    stp = s.topic
    sid = misc.pathLast(stp)
    rs = {"sessionId": sid}
    if not rss:
        vprint("emailFailed")
        rs["emailFailed"] = 1
    return okResponse(rs)
Ejemplo n.º 2
0
def emitPage(webin):
    #def genHtmlPage(webin,txt,redirectOnTimeout=True,styleSheets=None,pageTitle=None):

    def genPage(txt):
        return gen.genHtmlPage(webin,
                               txt,
                               redirectOnTimeout=False,
                               pageTitle="Email Verification")

    """
  Handles the  api/contact - for people contacting ImageDiver
  """
    #print "VERIFY EMAIL"
    qs = getattr(webin, "queryString", None)
    if qs:
        qsp = urlparse.parse_qs(qs)
    usernames = qsp.get("user", None)
    if usernames == None:
        return genPage("Incorrect form for verification")
    username = usernames[0]
    codes = qsp.get("code", None)
    if codes == None:
        return genPage("Incorrect form for verification")
    code = codes[0]
    user = models.loadUserD("/user/" + username, webin.pageStore)
    #print "USER ",user.__dict__
    isTumblr = getattr(user, "tumblr_name", None)
    if user == None:
        return genPage("Problem in verification: unknown user")
    if user.validated:
        if isTumblr:
            return genPage("Your email has already been verified.  Thanks!")
        else:
            return genPage(
                "Your email has already been verified. You can log in now. Thanks!"
            )

    stored_code = user.validation_code
    codeok = stored_code == code

    if codeok:
        user.validated = 1
        user.dynsave(isNew=False)
        if isTumblr:
            return genPage("Your email has been verified. Thanks!")
        else:
            return genPage(
                "Your email has been verified. You can log in now. Thanks!")

    else:
        return genPage("Problem in verification: incorrect code")
        txt = "BAD CODE"
Ejemplo n.º 3
0
def resend(webin):
    Logr.log("test",
             "TEST CONSTANT " + str(getattr(constants, "testvar", None)))
    pcn = json.loads(webin.content())
    uname = pcn["user"]
    pw = pcn["password"]
    u = models.loadUserD("/user/" + uname, webin.pageStore)
    if u == None:
        return failResponse("noSuchUser")
    pok = u.checkPassword(pw)
    if not pok:
        return failResponse("badPassword")
    ses.sendValidationEmail(u)
    return okResponse()
Ejemplo n.º 4
0
def emitPage(webin):
    qs = webin.queryString
    #print "WEBIN", webin.__dict__
    cn = webin.content()
    if not cn:
        emitError()
    vprint("CN", cn)
    #print "CN",cn
    cnd = cn[cn.find("=") + 1:]
    if cnd[0:3] == "%7B":
        cnd = urllib.unquote_plus(cnd)
        vprint("UNQUOTED TO ", cnd)
    else:
        vprint("NO UNQUOTING NEEDED")
    qd = json.loads(cnd)
    """
  if not ("topic" in qd):
    emitError()
  topic = qd["topic"]
  """
    sess = webin.session
    if not sess:
        body = """
<div>To post an annotation to Tumblr, you need to be logged in.</div><div>You can use your Tumblr account to <a href="/login">log in</a>.</div>"""
        return gen.genStaticPage(webin, "ImageDiver Message", body)
    user = sess.user
    userD = models.loadUserD(user)
    uName = getattr(userD, "name", "Anonymous")
    tk = getattr(userD, "tumblr_token", None)
    if not tk:
        return authorizeTumblr()
    try:
        uinf = userD.tumblrInfo()
    except Exception as ex:  # case where tumblr access has been revoked
        return authorizeTumblr(topic)
    blogs = uinf['blogs']
    blogUrls = [b['url'] for b in blogs]
    qd["blogs"] = blogUrls
    qd["userName"] = uName
    #def genDynPage(webin,jsFiles,options,redirectOnTimeout=True,pageTitle =None,body='',staticSize=False):
    #options = {"blogs":blogUrls,"topic":topic} #,"snap":snapD.__dict__}
    return gen.genDynPage(webin,
                          js,
                          qd,
                          headLines,
                          pageTitle="Post to Tumblr",
                          staticSize=True)
Ejemplo n.º 5
0
def newPassword(webin):
    Logr.log("test",
             "TEST CONSTANT " + str(getattr(constants, "testvar", None)))
    pcn = json.loads(webin.content())
    utopic = pcn["user"]
    code = pcn["code"]
    pw = pcn["password"]
    user = models.loadUserD(utopic, webin.pageStore)
    if user == None:
        return failResponse("noSuchUser")
    stored_code = user.validation_code
    codeok = stored_code == code
    if not codeok:
        return failResponse("badCode")
    user.setPassword(pw)
    user.dynsave(False)
    return okResponse()
Ejemplo n.º 6
0
def emitPage(webin):
    sess = webin.session
    if sess:
        #return gen.genHtmlPage(webin,"",headerTitle,headLines,"You are already logged in.")
        return gen.genHtmlPage(webin,
                               "",
                               styleSheets=styleSheets,
                               pageTitle="You are already logged in.")
    else:
        qs = webin.queryString
        if not qs:
            return gen.genHtmlPage(webin,
                                   "",
                                   styleSheets=styleSheets,
                                   pageTitle="Expected '?user=<uid>'")
        qsp = urlparse.parse_qs(qs)
        uid = qsp.get("user", None)
        if not uid:
            return gen.genHtmlPage(webin,
                                   "",
                                   styleSheets=styleSheets,
                                   pageTitle="Expected '?user=<uid>'")
        uid = uid[0]
        user = "******" + uid
        usrd = models.loadUserD(user)
        if not usrd:
            return gen.genHtmlPage(webin,
                                   "",
                                   styleSheets=styleSheets,
                                   pageTitle="No such user.")
        opts = {
            "uid": uid,
            "name": usrd.name,
            "accepted_terms": getattr(usrd, "accepted_terms"),
            "tumblr_name": getattr(usrd, "tumblr_name", ""),
            "twitter_name": getattr(usrd, "twitter_name", "")
        }
        return gen.genStdPage(webin,
                              'terms',
                              options=opts,
                              pageTitle="Welcome",
                              staticSize=True)
Ejemplo n.º 7
0
def updateUser(webin):
    Logr.log("test",
             "TEST CONSTANT " + str(getattr(constants, "testvar", None)))
    pcn = json.loads(webin.content())
    uname = pcn["userId"]
    vprint("uname", uname)
    cks = webin.checkSessionResponse()
    if cks: return cks
    session = webin.session
    suserId = misc.pathLast(session.user)
    if suserId != uname:
        return failResponse("wrongUser")
    pw = pcn.get("password", None)
    name = pcn["name"]
    email = pcn["email"].strip()
    u = models.loadUserD("/user/" + uname, webin.pageStore)

    if u == None:
        return failResponse()
    oldemail = getattr(u, "email", "")
    if email and (oldemail != email):
        eu = dynamo.emailToUser(pcn["email"])
        if eu != None:
            return failResponse("emailInUse")
    nu = models.UserD(None)
    nu.topic = '/user/' + uname
    nu.name = name
    if pw: nu.setPassword(pw)
    nu.email = email
    vprint("old email", oldemail, "new ", email)
    if (oldemail != email):
        rs = ses.sendEmailChangedEmail(nu)
        if rs:
            nu.dynsave(False)
            if oldemail:
                dynamo.deleteEmailToUserEntry(oldemail)
            return okResponse()
        else:
            return failResponse("Unable to send email to " + email)
    nu.dynsave(False)
    return okResponse()
Ejemplo n.º 8
0
def emitPage(webin):

    sess = webin.session
    if sess == None:
        return gen.genHtmlPage(
            webin, "", "ImageDiver session timeout", [],
            "Your session has expired. Please log in again.")

        user = ""
    else:
        user = sess.user
        usrd = models.loadUserD(user, webin.pageStore)
        hasEmail = 1 if getattr(usrd, "email", None) else 0
        opts = {
            "loggedInUser": user,
            "utilization": usrd.storageUtilization(),
            "allocation": usrd.allocation()["storage"],
            "hasEmail": hasEmail
        }
        return gen.genStdPage(webin, 'upload', opts, 'import', staticSize=True)
        return gen.genDynPage(webin, js, {"topbarTitle": "<i>Import</i>"},
                              opts)
Ejemplo n.º 9
0
def emitPage(webin):
  qs = webin.queryString
  print "WEBIN", webin.__dict__
  cn = webin.content()
  if not cn:
    emitError()
  print "CN",cn
  cnd = cn[cn.find("=")+1:]
  print "CND ",cnd
  qd=json.loads(cnd)
  """
  print qd
  if not ("topic" in qd):
    emitError()
  topic = qd["topic"]
  print "TOPIC ",topic
  """
  sess = webin.session
  if not sess:
    body = """
<div>To post an annotation to Tumblr, you need to be logged in. (Registering at ImageDiver is free)</div>"""
    return gen.genStaticPage(webin,"ImageDiver Message",body);
  user = sess.user;
  userD = models.loadUserD(user)
  tk = getattr(userD,"tumblr_token",None)
  if not tk:
    return authorizeTumblr()
  try:
    uinf = userD.tumblrInfo()
  except Exception as ex: # case where tumblr access has been revoked
    return authorizeTumblr(topic)
  blogs = uinf['blogs']
  blogUrls = [b['url'] for b in blogs]
  qd["blogs"] = blogUrls
  #options = {"blogs":blogUrls,"topic":topic} #,"snap":snapD.__dict__}
  return gen.genDynPage(webin,js,{},qd,headLines,pageTitle="Post to Tumblr")
Ejemplo n.º 10
0
def emitPage(webin):
    def genErrPage(txt):
        return gen.emitMessagePage(webin, "Reset Password", txt)

    #def genPage(jsOptions):
    #  return gen.genDynPage(webin,jsIncludes,{"topbarTitle":"<i>the depths of high-resolution images, annotated</i>"},jsOptions=jsOptions,headLines=headLines)
    #return WebResponse("200 OK","text/html",gen.genHtmlPage(webin,'',"ImageDiver Email Verification",[],txt))
    qs = getattr(webin, "queryString", None)
    if qs:
        qsp = urlparse.parse_qs(qs)
    usernames = qsp.get("user", None)
    if usernames == None:
        return genPage("Incorrect form for password-reset URL")
    username = usernames[0]
    codes = qsp.get("code", None)
    if codes == None:
        return genErrPage("Incorrect form for password-reset URL")
    code = codes[0]
    user = models.loadUserD("/user/" + username, webin.pageStore)

    if user == None:
        return genErrPage("Problem in reset-password: unknown user")
    stored_code = user.validation_code
    codeok = stored_code == code

    if codeok:
        return gen.genStdPage(webin,
                              'reset_password', {
                                  "user": "******" + username,
                                  "code": code,
                                  "email": user.email
                              },
                              staticSize=True)
    else:
        return genErrPage("Problem: incorrect code")
        txt = "BAD CODE"
Ejemplo n.º 11
0
def emitPage(webin):
    sess = webin.session

    if sess == None:
        return gen.emitMessagePage(webin, "Not logged in.", "Please log in.")

        user = ""
    else:
        user = sess.user
        usrd = models.loadUserD(user, webin.pageStore)
        uid = models.pathLast(usrd.topic)
        timed_out = sess.timed_out
        opts = {
            "timed_out": timed_out,
            "name": usrd.name,
            "email": getattr(usrd, "email", ""),
            "tumblr_name": getattr(usrd, "tumblr_name", ""),
            "twitter_name": getattr(usrd, "twitter_name", ""),
            "utilization": usrd.utilization(),
            "userId": uid,
            "allocation": usrd.allocation()
        }

    return gen.genStdPage(webin, 'me', opts, 'account', staticSize=True)
Ejemplo n.º 12
0
def tumblrPost1(user, params):
    cob = params
    userD = models.loadUserD(user)
    uid = misc.pathLast(user)
    ttk = getattr(userD, 'tumblr_token', None)
    if not ttk:
        return failResponse("noToken")
    tko = json.loads(ttk)
    token = tko["oauth_token"]
    token_secret = tko["oauth_token_secret"]
    vprint("Token", token)
    vprint("Token_secret", token_secret)
    topic = cob["topic"]
    blog = cob["blog"]
    imageSource = cob["imageSource"]
    linkTo = cob["linkTo"]
    tags = cob["tags"]
    caption = cob["caption"].encode("utf_8", "ignore")
    """
  topicsp = topic.split("/")
  kind = topicsp[1] # snap or album
  ownr = topicsp[2]
  ownerName = None
  if ownr != uid:
    ownru = models.loadUserD("/user/"+ownr)
    ownerName = ownru.name
  imname = topicsp[3]
  albumNum = topicsp[4]
 
  imageTitle = cob["imageTitle"]
  imageAuthor = cob["imageAuthor"]
  imageSource = cob["imageSource"]
  linkTo = cob["linkTo"]
  if kind=="snap":
    snap = cob["snap"]
    #print "snap",snap
    #cropId = snap["cropid"]
    #snapId = misc.pathLast(topic)
  scaption = snap.get("caption",None)
  sdes = snap.get("description",None)
  caption = "Click on the image to see the detail in a zoomable context\n\nDetail"
  tags = []
  
  if imageTitle:
    caption += " from *"+imageTitle+"*"
    if imageTitle.find(",") < 0:
      tags.append(imageTitle)
  if imageAuthor:
    caption += ", "+imageAuthor
    if imageAuthor.find(",") < 0:
      tags.append(imageAuthor)
  caption += "\n\n"
  if scaption:
    caption += scaption
  if sdes:
    if scaption:
      caption +=  "\n\n"
    caption += sdes.decode("utf8","ignore")
  if ownerName:
    caption += "\n\n From  "+ownerName+" at [Imagediver](http://imagediver.org)"
  #http://static.imagediver.org/images/4294b0e/van_eyck_arnolfini/snap/12.jpg?album=4294b0e.1
  #http://s3.imagediver.org/topic/album/4294b0e/van_eyck_arnolfini/1/index.html#snap=9
  cropUrl = "http://static.imagediver.org/images/"+ownr+"/"+imname+"/snap/"+str(cropId)+".jpg"
  clickThru = "http://s3.imagediver.org/topic/album/"+ownr+"/"+imname+"/"+albumNum+"/index.html#snap="+str(snapId)
  """
    params = {
        "type": "photo",
        "format": "markdown",
        "state": "draft",
        "link": linkTo,
        "source": imageSource
    }
    if caption:
        params["caption"] = caption
    if len(tags) > 0:
        params["tags"] = ",".join(tags)
    #params = {"type":"text","state":"draft","body":"Second TEST post"}
    #print "DESC",sdes
    #vprint("CAPTION",caption)
    #print "params",params

    try:
        oauth_tumblr.post(token, token_secret, blog, params)
    except Exception as ex:
        vprint("FAILED TO POST", ex)
        return False
    vprint("post complete")
    return True
    emitError()
  print "CN",cn
  cnd = cn[cn.find("=")+1:]
  print "CND ",cnd
  qd=json.loads(cnd)

  if not ("topic" in qd):
    emitError()
  topic = qd["topic"][0]
  sess = webin.session
  if not sess:
    body = """
<div>To post an annotation to Tumblr, you need to be logged in. (Registering at ImageDiver is free)</div>"""
    return gen.genStaticPage(webin,"ImageDiver Message",body);
  user = sess.user;
  userD = models.loadUserD(user)
  url = authorizeTumblr(user,topic)
  
  tk = getattr(userD,"tumblr_token",None)
  if not tk:
    url = authorizeTumblr(user,topic)
    return redirectResponse(url)
  try:
    uinf = userD.tumblrInfo()
  except Exception as ex: # case where tumblr access has been revoked
    url = authorizeTumblr(user,topic)
    return redirectResponse(url)
  blogs = uinf['blogs']
  blogUrls = [b['url'] for b in blogs]
  print "topic",topic
  #snapD = snapm.loadSnapD(topic)
Ejemplo n.º 14
0
def sendCompletionEmail(job):
    o = job.owner
    u = models.loadUserD('/user/' + o, thePageStore)
    if getattr(u, "email", None):
        ses.sendImportDoneEmail(u, job.subject)
Ejemplo n.º 15
0
def buildTiling(job, backend=False):
    print("BUILDING the TILING **************************")
    frontend = not backend
    job.status = "active"
    if frontend: saveJob(job)
    im = imageForJob(job)
    job.imTopic = im.topic  # not saved; used for cancelation
    tl = image.Tiling(im, 256, 1)
    stm = time.time()
    tl.createTiles([])
    numtiles = len(tl.tiles)
    print "TEST"
    print "BBuildingg Tiling of ", numtiles, " for " + im.topic
    job.total = numtiles
    job.status = "active"
    if frontend: saveJob(job)
    vprint(str(len(tl.tiles)))

    def recorder(tile, cnt):
        if backend:
            if cnt % 25 == 0: print "created ", cnt, " tiles"
            return True
        if checkJobCanceled(job): return False
        vprint(tile.__dict__)
        vprint(job.subject)
        job.so_far = cnt + 1
        saveJob(job)
        return True

    tl.createImageFiles(recorder)
    if job.status == "canceled":
        return
    imdir = im.imDir()
    sz = misc.du(imdir + "tiling")
    o = job.owner
    usr = models.loadUserD('/user/' + o, thePageStore)
    alc = usr.allocation()
    sta = alc["storage"]
    sut = usr.storageUtilization()
    vprint(o, "ALLOCATION ", sta, "UTILIZATION ", sut, "SIZE ", sz)
    if (sz + sut) > sta:
        job.status = "storageLimitExceeded"
        im.delete(fromS3=False)
        if getattr(usr, "email"):
            ses.sendStorageAllocationExceededEmail(usr,
                                                   job.subject,
                                                   allocation=sta,
                                                   utilization=sut,
                                                   size=sz)
    else:
        im.s3Storage = sz
        im.beenTiled = 1
        im.dynsave()
        job.status = "done"
        #im.removeSubdir("stepdown")
        im.deleteStepdowns(1)  # keep the original image
    job.so_far = numtiles
    job.resources_used = json.dumps({
        "time": time.time() - stm,
        "num_tiles": numtiles
    })
    saveJob(job)
Ejemplo n.º 16
0
def emitAlbumPage(webin, parsedPath, parsedQuery, forHomePage):
    pageStore = {}
    import model.album
    album = model.album
    vprint("parsedQuery " + str(parsedQuery))
    vprint("emitAlbumPage")
    sess = webin.session
    if sess == None:
        user = ""
    else:
        user = sess.user

    qs = getattr(webin, "queryString", None)
    published = 0  # is this the published version?
    """
  now, if we're here its unpublished 
  if qs:
    qsp = urlparse.parse_qs(qs)
    published = 0 if qsp.get('unpublished',False) else 1
  """

    name = parsedPath.name
    Logr.log("newdb", str(name))
    if len(name) < 3:
        return gen.emitNotFound(webin)

        #return gen.genStaticPage(webin,"ImageDiver Message"," <center><b>404</b></center><p><center>No such page</center></p>");

    imowner = name[0]
    imname = name[1]
    albumname = name[2]
    albumTopic = "/album/" + imowner + "/" + imname + "/" + albumname
    imageTopic = "/image/" + imowner + "/" + imname
    if albumname == "-":
        albumD = "-"
    else:
        albumD = album.loadAlbumD(albumTopic, webin.pageStore)

    if not albumD:
        #todo add error page here
        return gen.genStaticPage(webin, "ImageDiver Message",
                                 "<center><b>No such album</b></center>")
    im = image.loadImageD(imageTopic, webin.pageStore)
    imHasAlbums = album.hasAlbums(
        imageTopic, user)  # does this user have albums on this image
    imDict = models.toDict(im, [
        "dimensions", "title", "name", "author", "year", "externalLink",
        "description", "owner", "topic", "tilingDepthBump", "zoomDepthBump",
        "source"
    ])

    if albumD == "-":
        ownerD = models.loadUserD(user, webin.pageStore)
        ownerName = getattr(ownerD, "name", None)

        options = {
            "imageD": imDict,
            "imageTopic": imageTopic,
            "loggedInUser": user,
            "ownerName": ownerName,
            "albumOwner": user,
            "published": False
        }
        otxt = genAlbumPage(options)
        return htmlResponse(otxt)

    #print "IMDICT ",imDict
    author = getattr(im, "author", None)
    if author == None:
        author = ""
    else:
        author = ", " + author
    ttl = getattr(im, "title", "")
    albowner = albumD.owner
    vprint("OWNER ", albowner, user)
    if (not constants.devVersion) and (albowner != user):
        return gen.genStaticPage(
            webin, "ImageDiver Message",
            "<center><b>This is an unpublished album</b></center>")

    beenPublished = getattr(albumD, "published", 0)
    vprint("beenPublished", beenPublished)
    ownerD = models.loadUserD(albowner, webin.pageStore)
    ownerName = getattr(ownerD, "name", None)
    apub = getattr(albumD, "published", None)
    if published and (not apub):
        return gen.genStaticPage(
            webin, "ImageDiver Message",
            "<center><b>This album has not yet been published</b></center>")

    #imageTopic = albumD.image
    #options = {"imageD":imDict,"albumOwner":albumD.owner,"albumOwnerName":ownerName,"loggedInUser":user,"hasAlbums":imHasAlbums,
    #          "albumTopic":albumD.topic,"published":published,"beenPublished":beenPublished,"path":"/"}

    options = {
        "imageD": imDict,
        "albumOwner": albumD.owner,
        "albumOwnerName": ownerName,
        "loggedInUser": user,
        "imTitle": ttl,
        "imAuthor": author,
        "albumTopic": albumD.topic,
        "imageTopic": imageTopic,
        "published": published,
        "beenPublished": beenPublished,
        "path": webin.path
    }
    vprint("OPTIONS", options)
    otxt = genAlbumPage(options)
    #snaps.closeStore(webin.pageStore)

    return htmlResponse(otxt)
Ejemplo n.º 17
0
#!/usr/bin/env python
# python /var/www/neo.com/script_tests/dstoretest2.py
PYTHONPATH=$PYTHONPATH:"/mnt/ebs0/imagediverdev/py"
export PYTHONPATH
cd /mnt/ebs0/imagediverdev/py

python
import store.theStore
theStore = store.theStore
import store.dynamo
dyn = store.dynamo
import model.models
models = model.models
import store.snaps
snaps = store.snaps

uu = models.loadUserD("/user/cg")
uu.validated = 1
uu.dynsave()


 



Ejemplo n.º 18
0
def setTumblrToken(webin):

    cn = webin.content()
    #print "CONTENT",cn
    cob = json.loads(cn)
    token = cob["oauth_token"]
    token_secret = cob["oauth_token_secret"]
    verifier = cob["verifier"]
    signingIn = cob.get("signingIn", False)
    if not signingIn:
        cks = webin.checkSessionResponse()
        if cks: return cks
    access_token = oauth_tumblr.getAccessToken(verifier, token, token_secret)
    #print "ACCESS TOKEN ",access_token
    atkj = json.dumps(access_token)
    if signingIn:
        uinfj = oauth_tumblr.getUserInfo(access_token["oauth_token"],
                                         access_token["oauth_token_secret"])
        #print "UINFJ",uinfj
        uinf = json.loads(uinfj)
        tuname = uinf["response"]['user']['name']
        vprint("TUNAME", tuname)
        exu = models.loadUserDbyTumblr(tuname)
        rs = {"tumblr_name": tuname}
        if exu:
            vprint("Existing tumblr user")
            exu.tumblr_token = atkj
            exu.dynsave(False)
            tac = getattr(exu, "accepted_terms", 0)
            #tac = 1
            rs["accepted_terms"] = tac
            utp = exu.topic
            uid = misc.pathLast(utp)
            rs["userId"] = uid
            if tac:
                # go ahead and generate a new session for this fellow
                s = exu.newSession()
                stp = s.topic
                sid = misc.pathLast(stp)
                rs["sessionId"] = sid
            return okResponse(rs)
        else:
            vprint("NEW TUMBLR USER")
            ucnt = dynamo.getCount("/user/count")
            if ucnt >= constants.maxUsers:
                rs["hit_limit"] = 1
                return okResponse(rs)
            uid = dynamo.genNewUserId()
            nu = models.UserD(None)
            nu.topic = '/user/' + uid
            nu.name = tuname
            nu.tumblr_name = tuname
            nu.storage_allocation = constants.initial_storage_allocation
            nu.bandwidth_allocation = constants.initial_bandwidth_allocation
            nu.accepted_terms = 0
            nu.tumblr_token = atkj
            nu.dynsave(True)
            dynamo.bumpCount("/user/count")
            vprint("NEW TUMBLR USER SAVED")
            rs["accepted_terms"] = 0
            rs["userId"] = uid

            return okResponse(rs)
    """ getting a access token in the course of a post to tumblr """
    sess = webin.session
    user = sess.user
    userD = models.loadUserD(user)
    atkj = json.dumps(access_token)
    userD.tumblr_token = atkj
    userD.dynsave(False)
    return okResponse()
Ejemplo n.º 19
0
jb.save()

jb.save()



models.addImageToDb("cg","sthellens")

models.loadImageD("/image/cg/sthellens")

dyn.getDict("Album","/album/ccc/bathing_1/8")
ims = models.allImages()


uu = dyn.getUser('/user/cg')
uuu = models.loadUserD('/user/foobmm')

nn = models.UserD(None)
nn.topic = '/user/foob'
nn.name  = "mr foob"
nn.setPassword("abcdef")
nn.email = "*****@*****.**"
nn.dynsave()



models.deleteSnap("/album/cg/The_Ambassadors/3/1")

models
ss = models.loadSnapD("/album/cg/The_Ambassadors/3/1")
Ejemplo n.º 20
0
PYTHONPATH=$PYTHONPATH:"/mnt/ebs0/imagediverdev/py"
export PYTHONPATH
cd /mnt/ebs0/imagediverdev/py

python
import store.theStore
theStore = store.theStore
import store.dynamo
dyn = store.dynamo
import model.models
models = model.models
import store.snaps
snaps = store.snaps
import store.jobs
jobs = store.jobs
import ops.logs
logs = ops.logs
import store.log
logstore = store.log
import api.register
import boto

#api.register.connectToSes()


test9 = models.loadUserD('/user/test9')


api.register.sendValidationEmail(test1)