예제 #1
0
        def wrapper():
            self.redirect = self.get_redirect()
            key = drdoom.request().matchdict
            uid = drdoom.get_uid()

            #Case for shopfront public is not exists
            if 'shopfront_name' in key:
                shopfront_name = key['shopfront_name']
                self.error_message = "No shop found here"
                if not f.model.shopfront.is_shopfront_published(
                        shopfront_name):
                    Rumor.track_wizard(self, shopfront_name=shopfront_name)
                    drdoom.set_error(self.error_message)
                    response = HTTPFound(location=self.redirect)
                else:
                    response = fn()
            else:
                #Case for the user haven't published their shopfront
                self.error_message = "Shopfront not published yet"
                shopfront_name = f.model.user.get_subdomain(uid)
                if not f.model.shopfront.is_shopfront_published(
                        shopfront_name):
                    Rumor.track_wizard(self, shopfront_name=shopfront_name)
                    response = HTTPFound(location=self.redirect)
                else:
                    response = fn()

            return response
예제 #2
0
        def wrapper():
            if self.check_error():
                drdoom.set_error(self.error_message)
                Rumor.track_wizard(self)
                response = self.get_redirect(self.redirect, self.ajax)
            else:
                response = fn()

            return response
예제 #3
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "not logging in"
            if drdoom.islogin():
                response = fn()
            else:
                Rumor.track_wizard(self)
                response = HTTPFound(location=self.redirect)

            return response
예제 #4
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "not in sell mode"
            iid = drdoom.get('iid')
            if iid is not None:
                response = fn()
            else:
                Rumor.track_wizard(self)
                response = HTTPFound(location=self.redirect)

            return response
예제 #5
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "you are not dashsell admiral"
            uid = drdoom.get_uid()
            if f.model.user.is_admiral(uid):
                response = fn()
            else:
                Rumor.track_wizard(self, uid=uid)
                response = HTTPFound(location=self.redirect)

            return response
예제 #6
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "not in edit mode"
            is_edit = drdoom.get('edit_item')
            if is_edit:
                response = fn()
            else:
                Rumor.track_wizard(self)
                response = HTTPFound(location=self.redirect)

            return response
예제 #7
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "Subdomain is not being set"
            key = drdoom.request().matchdict
            uid = drdoom.get_uid()
            if not f.model.user.get_subdomain(uid):
                Rumor.track_wizard(self, uid=uid)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #8
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "not premium user"
            key = drdoom.request().matchdict
            uid = drdoom.get_uid()
            if f.model.user.is_premium(uid):
                response = fn()
            else:
                Rumor.track_wizard(self, uid=uid)
                response = HTTPFound(location=self.redirect)

            return response
예제 #9
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "Not the item owner"
            key = drdoom.request().matchdict
            uid = drdoom.get_uid()
            iid = int(key['iid'])
            if not f.model.item.is_item_owner(iid, uid):
                Rumor.track_wizard(self, iid=iid, uid=uid)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #10
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "No shop found here"
            key = drdoom.request().matchdict
            shopfront_name = key['shopfront_name']
            if not f.model.shopfront.get_owner(shopfront_name):
                Rumor.track_wizard(self, shopfront_name=shopfront_name)
                drdoom.set_error(self.error_message)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #11
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "not shopfront owner"
            key = drdoom.request().matchdict
            uid = drdoom.get_uid()
            shopfront_name = key['shopfront_name']
            if uid == f.model.shopfront.get_owner(shopfront_name):
                response = fn()
            else:
                Rumor.track_wizard(self,
                                   shopfront_name=shopfront_name,
                                   uid=uid)
                response = HTTPFound(location=self.redirect)

            return response
예제 #12
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "country unset"
            if drdoom.islogin():
                uid = drdoom.get_uid()
                cid = f.model.user.get_country(uid)
                if cid != 0:
                    response = fn()
                else:
                    Rumor.track_wizard(self)
                    response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #13
0
        def wrapper():
            post = drdoom.request().POST

            response = fn()
            if 'adcopy_response' in post and 'adcopy_challenge' in post:
                captcha_response = req['adcopy_response']
                captcha_challenge = req['adcopy_challenge']
                if not f.etc.captcha.verify(captcha_response,
                                            drdoom.request().remote_addr,
                                            challenge=captcha_challenge):
                    Rumor.track_wizard(self)
                    drdoom.set_error(self.error_message)
                    response = HTTPFound(location='/confirm')

            return response
예제 #14
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "Shops not completed yet"
            uid = drdoom.get_uid()

            total_progress = 0
            total_progress += f.etc.progress.shop_progress(uid)
            total_progress += f.etc.progress.shop_listing_progress(uid)

            if total_progress < 200:
                Rumor.track_wizard(self, uid=uid, progress=total_progress)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #15
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "item shopfront not exist"
            key = drdoom.request().matchdict
            if 'shopfront_name' in key:
                shopfront_name = key['shopfront_name']
                uid = f.model.shopfront.get_owner(shopfront_name)
            else:
                uid = drdoom.get_uid()
            iid = int(key['iid'])
            if not f.model.item.is_item_owner(iid, uid):
                Rumor.track_wizard(self, iid=iid, uid=uid)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #16
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "shopfront broadcast not exist"
            key = drdoom.request().matchdict
            if 'shopfront_name' in key:
                shopfront_name = key['shopfront_name']
                uid = f.model.shopfront.get_owner(shopfront_name)
            else:
                uid = drdoom.get_uid()
            broadcast_id = int(key['broadcast_id'])
            shopfront_id = f.model.broadcast.get_broadcast_source(broadcast_id)
            owner_id = f.model.shopfront.get_owner_by_id(shopfront_id)
            if owner_id != uid:
                Rumor.track_wizard(self, broadcast_id=broadcast_id, uid=uid)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response
예제 #17
0
        def wrapper():
            self.redirect = self.get_redirect()
            self.error_message = "item does not exist"
            error = False
            key = drdoom.request().matchdict
            iid = key['iid']
            try:
                iid = int(iid)
                details = f.model.item.get_details(iid)
                if details is None:
                    error = True
            except:
                error = True
            if error:
                Rumor.track_wizard(self, iid=iid)
                response = HTTPFound(location=self.redirect)
            else:
                response = fn()

            return response