Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove c.PATH property for getting site section #4359

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions uber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,6 @@ class Config(_Overridable):
For all of the datetime config options, we also define BEFORE_ and AFTER_ properties, e.g. you can
check the booleans returned by c.BEFORE_PLACEHOLDER_DEADLINE or c.AFTER_PLACEHOLDER_DEADLINE
"""
def __init__(self):
self._PATH = cherrypy.request.path_info.replace(cherrypy.request.path_info.split('/')[-1], '').strip('/')

def get_oneday_price(self, dt):
return self.BADGE_PRICES['single_day'].get(dt.strftime('%A'), self.DEFAULT_SINGLE_DAY)

Expand Down Expand Up @@ -838,14 +835,6 @@ def PAGE_PATH(self):
def PAGE(self):
return cherrypy.request.path_info.split('/')[-1]

@property
def PATH(self):
return self._PATH

@PATH.setter
def PATH(self, value):
self._PATH = value

@request_cached_property
@dynamic
def ALLOWED_ACCESS_OPTS(self):
Expand Down
8 changes: 4 additions & 4 deletions uber/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,20 +707,20 @@ def restricted(func):
@wraps(func)
def with_restrictions(*args, **kwargs):
if not func.public:
if c.PATH == 'staffing':
if '/staffing/' in c.PAGE_PATH:
if not cherrypy.session.get('staffer_id'):
raise HTTPRedirect('../staffing/login?message=You+are+not+logged+in', save_location=True)

elif cherrypy.session.get('account_id') is None:
raise HTTPRedirect('../accounts/login?message=You+are+not+logged+in', save_location=True)

elif c.PATH == 'mivs_judging':
elif '/mivs_judging/' in c.PAGE_PATH:
if not uber.models.AdminAccount.is_mivs_judge_or_admin:
return 'You need to be a MIVS Judge or have access for either {} or {}'.format(c.PATH, c.PAGE_PATH)
return f'You need to be a MIVS Judge or have access to {c.PAGE_PATH}'

else:
if not c.has_section_or_page_access(include_read_only=True):
return 'You need access for either {} or {}.'.format(c.PATH, c.PAGE_PATH)
return f'You need access to {c.PAGE_PATH}.'

return func(*args, **kwargs)
return with_restrictions
Expand Down
Loading