예제 #1
0
def create_folder(path, userkey):
    folder = Folder()
    folder.user_id = userkey
    folder.path = path
    now = datetime.now()
    folder.cdate = now.strftime("%m/%d/%Y %H:%M:%S")
    folder.size = ""
    folder_key = folder.put()
예제 #2
0
    def post(self):
        email = self.request.get("userEmail")
        upass = self.request.get("userPassword")
        upass_c = self.request.get("confirmPassword")

        if upass != upass_c:
            template_values = {
                'title': 'DropBox Application | Sign Up',
                'errmsg': 'Password dismatch',
                'email': email,
            }
            # self.redirect('/signup')
            path = os.path.join(os.path.dirname(__file__),
                                "templates/signup.html")
            self.response.write(template.render(path, template_values))
        else:
            if self.checkUser(email) > 0:
                template_values = {
                    'title': 'DropBox Application | Sign Up',
                    'errmsg': 'User duplicated',
                    'email': email,
                }
                # self.redirect('/signup')
                path = os.path.join(os.path.dirname(__file__),
                                    "templates/signup.html")
                self.response.write(template.render(path, template_values))
            else:
                user = User()
                user.password = upass
                user.email = email

                user_key = user.put()

                # Put session variable user as user's key
                self.session['root'] = str(user_key.id())

        folder = Folder()

        folder.user_id = str(user_key.id())
        folder.path = str(user_key.id())
        folder_key = folder.put()

        # Redirect to home
        self.redirect('/')