Exemple #1
0
 def _checkParams(self, params):
     RHConferenceModifBase._checkParams(self, params)
     if 'fileId' not in params:
         raise NotFoundError(_("Missing 'fileId' argument."))
     self._offlineEvent = ModuleHolder().getById(
         "offlineEvents").getOfflineEventByFileId(params["confId"],
                                                  params["fileId"])
     if not self._offlineEvent or not self._offlineEvent.file or \
        not os.path.isfile(self._offlineEvent.file.getFilePath()):
         raise NotFoundError(
             _("The file you tried to access does not exist anymore."))
    def _checkParams(self, params):
        self._page = None
        RHConferenceBaseDisplay._checkParams(self, params)

        if 'pageId' in params:
            pageId = params.get("pageId")
            intPagesMgr = internalPagesMgr.InternalPagesMgrRegistery().getInternalPagesMgr(self._conf)
            self._page = intPagesMgr.getPageById(pageId)
            self._target = self._conf

            if self._page is None:
                raise NotFoundError(_("The web page you are trying to access does not exist"))
        else:
            raise NotFoundError(_("The web page you are trying to access does not exist"))
Exemple #3
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)
        authorObj = self._contrib.getAuthorById(self._authorId)

        not_found = NotFoundError(_("No author with id {} was found").format(
            self._authorId),
                                  title=_("Author not found"))

        if authorObj is None:
            raise not_found
        authorList = self._conf.getAuthorIndex().getByAuthorObj(authorObj)
        if authorList is None:
            raise not_found
        author = authorList[0]
        vars["contributions"] = [
            auth.getContribution() for auth in authorList
            if auth.getContribution().getConference()
        ]
        vars["fullName"] = author.getFullName()
        if self._aw.getUser() is not None:
            vars["email"] = author.getEmail()
        vars["address"] = author.getAddress()
        vars["telephone"] = author.getPhone()
        vars["fax"] = author.getFax()
        vars["affiliation"] = author.getAffiliation()
        return vars
Exemple #4
0
 def _checkParams( self, params ):
     conferenceModif.RHConferenceModifBase._checkParams(self, params)
     regId=params.get("registrantId",None)
     if regId is None:
         raise MaKaCError(_("registrant id not set"))
     self._registrant=self._conf.getRegistrantById(regId)
     if self._registrant is None:
         raise NotFoundError(_("The registrant with id %s does not exist or has been deleted")%regId)
Exemple #5
0
 def _checkParams(self, params):
     if "userId" not in params or params["userId"].strip() == "":
         raise MaKaCError(_("user id not specified"))
     ah = user.AvatarHolder()
     self._target = self._avatar = ah.getById(params["userId"])
     if self._avatar == None:
         raise NotFoundError(
             "The user id does not match any existing user.")
Exemple #6
0
 def _checkParams(self, params):
     l = locators.CategoryWebLocator(params)
     self._target = l.getObject()
     if self._target is None:
         raise NotFoundError(_(
             "The category with id '{}' does not exist or has been deleted"
         ).format("<strong>{}</strong>".format(params["categId"])),
                             title=_("Category not found"))
Exemple #7
0
    def _checkParams(self, params, mustExist=True):
        if "categId" in params:
            params["categId"] = escape_html(str(params["categId"]))
        l = locators.CategoryWebLocator(params, mustExist)
        self._target = l.getObject()

        # throw an error if the category was not found
        if mustExist and self._target is None:
            raise NotFoundError(_("The category with id '{}' does not exist or has been deleted").format(
                                "<strong>{}</strong>".format(params["categId"])),
                                title=_("Category not found"))
 def _checkParams( self, params ):
     RHConferenceBaseDisplay._checkParams( self, params )
     self._auth = "authorId" in params
     self._chair = "chairId" in params
     if params.has_key("contribId"):
         contrib = self._conf.getContributionById(params.get("contribId",""))
     if self._chair:
         chairid=params.get("chairId","")
         chair = self._conf.getChairById(chairid)
         if chair == None:
             raise NotFoundError(_("The chair you try to email does not exist."))
         self._emailto = chair
     if self._auth:
         authid = params.get("authorId", "")
         if not contrib:
             raise MaKaCError(_("The author's contribution does not exist anymore."))
         author = contrib.getAuthorById(authid)
         if author == None:
             raise NotFoundError(_("The author you try to email does not exist."))
         self._emailto = author
 def _checkParams(self, params):
     RHRegistrationFormDisplayBase._checkParams(self, params)
     self._registrant = None
     regId = params.get("registrantId", None)
     if regId is None:
         raise MaKaCError(_("registrant id not set"))
     self._registrant = self._conf.getRegistrantById(regId)
     if self._registrant is None:
         raise NotFoundError(
             _("The registrant with id %s does not exist or has been deleted"
               ) % regId)
 def getById(self, id, quiet=False):
     id = str(id)
     if is_legacy_id(id):
         mapping = LegacyEventMapping.find_first(legacy_event_id=id)
         id = str(mapping.event_id) if mapping is not None else None
     event = self._getIdx().get(id) if id is not None else None
     if event is None and not quiet:
         raise NotFoundError(
             _("The event with id '{}' does not exist or has been deleted"
               ).format(id),
             title=_("Event not found"))
     return event
Exemple #11
0
    def _checkParams(self, params):
        l = locators.WebLocator()
        l.setMaterial(params)
        self._material = self._target = l.getObject()
        if self._material is None:
            raise NotFoundError(_(
                "The material you are trying to access does not exist or was removed"
            ).format("<strong>{}</strong>".format(params['confId'])),
                                title=_("Resource not found"))

        self._conf = self._material.getConference()
        if self._conf is None:
            self._categ = self._material.getCategory()
Exemple #12
0
    def _checkParams(self, params):
        if not session.user:
            # Let checkProtection deal with it.. no need to raise an exception here
            # if no user is specified
            return

        if not params.setdefault('userId', session.get('_avatarId')):
            raise MaKaCError(_("user id not specified"))

        ah = user.AvatarHolder()
        self._target = self._avatar = ah.getById(params['userId'])
        if self._avatar is None:
            raise NotFoundError("The user id does not match any existing user.")
Exemple #13
0
    def _process_retry_do(self, profile):
        profile_name, res = '', ''
        try:
            # old code gets parameters from call
            # new code utilizes of flask.request
            if len(inspect.getargspec(self._checkParams).args) < 2:
                cp_result = self._checkParams()
            else:
                cp_result = self._checkParams(self._reqParams)

            if isinstance(cp_result, (current_app.response_class, Response)):
                return '', cp_result

            func = getattr(self, '_checkParams_' + request.method, None)
            if func:
                cp_result = func()
                if isinstance(cp_result,
                              (current_app.response_class, Response)):
                    return '', cp_result

        except NoResultFound:  # sqlalchemy .one() not finding anything
            raise NotFoundError(_('The specified item could not be found.'),
                                title=_('Item not found'))

        rv = self.normalize_url()
        if rv is not None:
            return '', rv

        self._checkProtection()
        func = getattr(self, '_checkProtection_' + request.method, None)
        if func:
            func()

        security.Sanitization.sanitizationCheck(self._target, self._reqParams,
                                                self._aw,
                                                self._doNotSanitizeFields)

        if self._doProcess:
            if profile:
                profile_name = os.path.join(
                    Config.getInstance().getTempDir(),
                    'stone{}.prof'.format(random.random()))
                result = [None]
                profiler.runctx('result[0] = self._process()', globals(),
                                locals(), profile_name)
                res = result[0]
            else:
                res = self._process()
        return profile_name, res
Exemple #14
0
 def _checkParams(self, params):
     RHRegistrationFormDisplayBase._checkParams(self, params)
     self._registrant = None
     self._registrant_id = params.get('registrantId', None)
     self._authkey = None
     if self._registrant_id:
         self._registrant = self._conf.getRegistrantById(self._registrant_id)
         if self._registrant is None:
             raise NotFoundError(_("The registrant with id {} does not exist or has been deleted")
                                 .format(self._registrant_id))
         self._authkey = params.get('authkey', '')
         if self._registrant.getRandomId() != self._authkey or self._authkey == '':
             raise AccessError()
     elif session.avatar:
         self._registrant = session.avatar.getRegistrantById(self._conf.getId())
Exemple #15
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)
        authorObj = self._contrib.getAuthorById(self._authorId)

        not_found = NotFoundError(_("No author with id {} was found").format(
            self._authorId),
                                  title=_("Author not found"))

        if authorObj is None:
            raise not_found
        authorList = self._conf.getAuthorIndex().getByAuthorObj(authorObj)
        if authorList is None:
            raise not_found
        author = authorList[0]
        contribList = []
        for auth in authorList:
            contrib = auth.getContribution()
            if contrib is not None:
                contribList.append({
                    'title':
                    contrib.getTitle(),
                    'url':
                    str(
                        urlHandlers.UHContributionDisplay.getURL(
                            auth.getContribution())),
                    'materials':
                    fossilize(contrib.getAllMaterialList())
                })
        vars["contributions"] = contribList
        vars["fullName"] = author.getFullName()
        if self._aw.getUser() is not None:
            vars["email"] = author.getEmail()
        vars["address"] = author.getAddress()
        vars["telephone"] = author.getPhone()
        vars["fax"] = author.getFax()
        vars["affiliation"] = author.getAffiliation()
        return vars
Exemple #16
0
 def _checkParams(self, params):
     try:
         RHLinkBase._checkParams(self, params)
     except:
         raise NotFoundError("The file you tried to access does not exist.")
Exemple #17
0
 def _checkParams(self, params):
     RHRegistrationForm._checkParams(self, params)
     if self._registrant is None:
         if not session.avatar and not params.get('registrantId', None):
             raise MaKaCError(_("registrant id not set"))
         raise NotFoundError(_("You are not registered or your registration has been deleted"))