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

[experimental] Dev docker fixes dom2022 #3949

Closed
Closed
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ MAINTAINER RAMS Project "[email protected]"
LABEL version.rams-core ="0.1"

# add our code
COPY . plugins/uber/
COPY . /app/sideboard/plugins/uber/
# go ahead and install base dependencies
RUN /app/env/bin/paver install_deps
18 changes: 11 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
cherrypy==17.3.0
celery==4.1.1
celery==5.2.7
python-dateutil==2.6.0
psycopg2
psycopg2-binary>=2.7.3.2
py3k-bcrypt==0.3
stripe==2.42.0
pytz==2017.2
pytz==2022.1
alembic==0.9.1
treepoem==1.0.1
email_validator==1.0.2
phonenumbers==8.8.1
pockets==0.6.2
residue==0.2.8
pockets==0.9.1

# hotfix
# residue==0.2.8
git+https://github.com/magfest/residue@update_to_latest_python#egg=residue

XlsxWriter==1.0.2
uszipcode==0.2.6
geopy==1.11.0
geopy==2.2.0
twilio==6.10.0
cherrys==0.4
redis==2.10.6
Expand All @@ -22,4 +26,4 @@ Pillow==8.3.2
fpdf==1.7.2
boto3==1.14.45
SQLAlchemy==1.3.0
Jinja2==2.11.3
Jinja2==3.0.3
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
name='uber',
packages=['uber'],
version=__version__,
author='Eli Courtwright',
author_email='[email protected]',
description='The MAGFest Ubersystem',
url='https://github.com/EliAndrewC/magfest',
install_requires=open('requirements.txt').readlines()
author='Eli Courtwright and others',
author_email='[email protected]',
description='The MAGFest Ubersystem - Ticket/Management platform',
url='https://github.com/magfest/ubersystem',
)
2 changes: 1 addition & 1 deletion uber/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2017.07'
__version__ = '2022.01'
14 changes: 12 additions & 2 deletions uber/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,25 @@ def with_check(*args, **kwargs):
return func(*args, **kwargs)
return with_check


def cherrypy_session_get(key):
try:
session = cherrypy.session
except AttributeError:
return None

return session.get(key)


def restricted(func):
@wraps(func)
def with_restrictions(*args, **kwargs):
if not func.public:
if c.PATH == 'staffing':
if not cherrypy.session.get('staffer_id'):
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:
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':
Expand Down
11 changes: 10 additions & 1 deletion uber/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, page, *args, **kwargs):
# useful if we want to redirect the user back to the same
# page after they complete an action, such as logging in
# example URI: '/uber/registration/form?id=786534'
original_location = cherrypy.request.wsgi_environ['REQUEST_URI']
original_location = self.get_cherrypy_wsgi_environ()

# Note: python does have utility functions for this. if this
# gets any more complex, use the urllib module
Expand All @@ -51,5 +51,14 @@ def __init__(self, page, *args, **kwargs):

cherrypy.HTTPRedirect.__init__(self, query)

@staticmethod
def get_cherrypy_wsgi_environ():
original_location = ''
try:
original_location = cherrypy.request.wsgi_environ['REQUEST_URI']
except AttributeError:
pass
return original_location

def quote(self, s):
return quote(s) if isinstance(s, str) else str(s)
3 changes: 2 additions & 1 deletion uber/models/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections import Mapping, OrderedDict
from collections.abc import Mapping
from collections import OrderedDict
from datetime import datetime, time, timedelta
from dateutil.parser import parse
import re
Expand Down
10 changes: 8 additions & 2 deletions uber/site_sections/statistics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import Counter, defaultdict, OrderedDict
from os.path import exists

from geopy.distance import VincentyDistance
from geopy.distance import geodesic
from pockets.autolog import log
from pytz import UTC
import six
Expand Down Expand Up @@ -260,8 +261,13 @@ def badges_sold(self, session):

zips_counter = Counter()
zips = {}
center = None

# TODO: use lazy loading instead of doing this here so it's only accessed on the first try.
# if /srv/reggie/data/ doesn't exist, this will barf loudly at startup.
try:
center = SearchEngine(db_file_dir="/srv/reggie/data").by_zipcode(20745)
if exists("/srv/reggie/data"):
center = SearchEngine(db_file_dir="/srv/reggie/data").by_zipcode(20745)
except Exception as e:
log.error("Error calling SearchEngine: " + e)

Expand Down
2 changes: 1 addition & 1 deletion uber/tasks/email.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Mapping
from collections.abc import Mapping
from datetime import timedelta
from time import sleep

Expand Down