@POST('^/api/v1/profile')
    @authenticated
    def update_profile(self, request):
        try:
            p = Profile(self.db)
            can_update_profile = (p.get().HasField("guid_key") or
                                  ("name" in request.args and
                                   "location" in request.args))
            if not can_update_profile:
                request_dict = {
                    "success": False,
                    "reason": "name or location not included"
                }
                request.write(json.dumps(request_dict, indent=4))
                request.finish()
                return False

            u = objects.Profile()
            if "name" in request.args:
                u.name = request.args["name"][0].decode("utf8")
            if "location" in request.args:
                # This needs to be formatted. Either here or from the UI.
                u.location = CountryCode.Value(request.args["location"][0].upper())
            if "handle" in request.args:
                if blockchainid.validate(request.args["handle"][0], self.keychain.guid.encode("hex")):
                    u.handle = request.args["handle"][0].decode("utf8")
                    self.db.profile.set_temp_handle("")
                else:
                    u.handle = ""
                    self.db.profile.set_temp_handle(request.args["handle"][0].decode("utf8"))
            if "about" in request.args:
                u.about = request.args["about"][0].decode("utf8")
            if "short_description" in request.args:
                u.short_description = request.args["short_description"][0].decode("utf8")
            if "nsfw" in request.args:
                p.profile.nsfw = str_to_bool(request.args["nsfw"][0])
            if "vendor" in request.args:
                p.profile.vendor = str_to_bool(request.args["vendor"][0])
            if request.args in "moderator":
                p.profile.moderator = str_to_bool(request.args["moderator"][0])
            if "moderation_fee" in request.args:
                p.profile.moderation_fee = round(float(request.args["moderation_fee"][0]), 2)
            if "website" in request.args:
                u.website = request.args["website"][0].decode("utf8")
            if "email" in request.args:
                u.email = request.args["email"][0].decode("utf8")
            if "primary_color" in request.args:
                p.profile.primary_color = int(request.args["primary_color"][0])
            if "secondary_color" in request.args:
                p.profile.secondary_color = int(request.args["secondary_color"][0])
            if "background_color" in request.args:
                p.profile.background_color = int(request.args["background_color"][0])
            if "text_color" in request.args:
                p.profile.text_color = int(request.args["text_color"][0])
            if "avatar" in request.args:
                u.avatar_hash = unhexlify(request.args["avatar"][0])
            if "header" in request.args:
                u.header_hash = unhexlify(request.args["header"][0])
            if "pgp_key" in request.args and "signature" in request.args:
                p.add_pgp_key(request.args["pgp_key"][0], request.args["signature"][0],
                              self.keychain.guid.encode("hex"))
            if not p.get().HasField("guid_key"):
                key = u.PublicKey()
                key.public_key = self.keychain.verify_key.encode()
                key.signature = self.keychain.signing_key.sign(key.public_key)[:64]
                u.guid_key.MergeFrom(key)
            p.update(u)
            request.write(json.dumps({"success": True}))
            request.finish()
            self.kserver.node.vendor = p.get().vendor
            return server.NOT_DONE_YET
        except Exception, e:
            request.write(json.dumps({"success": False, "reason": e.message}, indent=4))
            request.finish()
            return server.NOT_DONE_YET
dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/api/restapi.py/OpenBazaarAPI.update_profile/swapped operands of `in`