diff options
author | emkael <emkael@tlen.pl> | 2016-02-24 23:38:27 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-02-24 23:41:25 +0100 |
commit | 2173f7d7613b5158f4bb2f71a02df353c058c1ee (patch) | |
tree | eac23e40bc497706b862b5d2ca01920c4b37ed92 | |
parent | 6e72eace43adc48f0b311c26d66d13315e25fe93 (diff) |
* moving PHP app files to app/php and Python app files to app/python
-rw-r--r-- | app/php/application.xml (renamed from include/application.xml) | 0 | ||||
-rw-r--r-- | app/php/pages/Home.page (renamed from include/pages/Home.page) | 0 | ||||
l--------- | app/php/runtime | 1 | ||||
-rw-r--r-- | app/python/.gitignore (renamed from .gitignore) | 0 | ||||
-rw-r--r-- | app/python/rcal/__init__.py (renamed from rcal/__init__.py) | 0 | ||||
-rw-r--r-- | app/python/rcal/db.py (renamed from rcal/db.py) | 2 | ||||
-rw-r--r-- | app/python/rcal/model.py (renamed from rcal/model.py) | 0 | ||||
-rw-r--r-- | bin/import_cals.py | 11 | ||||
-rwxr-xr-x | bin/pyrun.sh | 2 | ||||
-rw-r--r-- | http/index.php | 2 | ||||
l--------- | include/runtime | 1 |
11 files changed, 11 insertions, 8 deletions
diff --git a/include/application.xml b/app/php/application.xml index 98f3af5..98f3af5 100644 --- a/include/application.xml +++ b/app/php/application.xml diff --git a/include/pages/Home.page b/app/php/pages/Home.page index 368b3e7..368b3e7 100644 --- a/include/pages/Home.page +++ b/app/php/pages/Home.page diff --git a/app/php/runtime b/app/php/runtime new file mode 120000 index 0000000..2cee2e0 --- /dev/null +++ b/app/php/runtime @@ -0,0 +1 @@ +../../cache/prado
\ No newline at end of file diff --git a/.gitignore b/app/python/.gitignore index df04015..df04015 100644 --- a/.gitignore +++ b/app/python/.gitignore diff --git a/rcal/__init__.py b/app/python/rcal/__init__.py index e69de29..e69de29 100644 --- a/rcal/__init__.py +++ b/app/python/rcal/__init__.py diff --git a/rcal/db.py b/app/python/rcal/db.py index 12fcd88..68d5b0d 100644 --- a/rcal/db.py +++ b/app/python/rcal/db.py @@ -13,7 +13,7 @@ class Session(object): def __init__(self): config = json.load( open(path.join(path.dirname( - path.realpath(__file__)), '..', 'conf', 'db.json'))) + path.realpath(__file__)), '../../..', 'conf', 'db.json'))) db_str = url.URL( drivername=config['type'], host=config['host'], diff --git a/rcal/model.py b/app/python/rcal/model.py index faed188..faed188 100644 --- a/rcal/model.py +++ b/app/python/rcal/model.py diff --git a/bin/import_cals.py b/bin/import_cals.py index 34e607d..41f5542 100644 --- a/bin/import_cals.py +++ b/bin/import_cals.py @@ -20,18 +20,21 @@ CONFIG = json.load(open( def main(): cal_list = None - if not os.path.exists(CONFIG['cache']) or \ - int(time.time()) - int(os.path.getmtime(CONFIG['cache'])) > \ + cache_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + CONFIG['cache']) + if not os.path.exists(cache_path) or \ + int(time.time()) - int(os.path.getmtime(cache_path)) > \ CONFIG['cache_time']: opener = urllib2.build_opener() opener.addheaders = [('User-Agent', CONFIG['user_agent'])] cal_list = json.loads(opener.open(CONFIG['reddit_url']).read()) cal_list = cal_list[0]['data']['children'][0]['data']['selftext'] - with open(CONFIG['cache'], 'w') as cache_file: + with open(cache_path, 'w') as cache_file: cache_file.write(cal_list) cache_file.close() else: - cal_list = open(CONFIG['cache'], 'r').read() + cal_list = open(cache_path, 'r').read() session = Session.create() diff --git a/bin/pyrun.sh b/bin/pyrun.sh index 188a0eb..36a3339 100755 --- a/bin/pyrun.sh +++ b/bin/pyrun.sh @@ -2,5 +2,5 @@ DIR=$(dirname $0) SCRIPT=$(echo $1 | sed 's/\.py\$//') shift -export PYTHONPATH=$DIR/.. +export PYTHONPATH=$DIR/../app/python/ python $DIR/$SCRIPT.py $@ diff --git a/http/index.php b/http/index.php index 1d47a53..26d9992 100644 --- a/http/index.php +++ b/http/index.php @@ -4,7 +4,7 @@ $basePath = dirname(__FILE__); $frameworkPath = $basePath . '/../lib/prado/framework/prado.php'; $assetsPath = $basePath . '/assets/'; -$applicationPath = $basePath . '/../include/'; +$applicationPath = $basePath . '/../app/php/'; $runtimePath = $basePath . '/../cache/prado/'; if(!is_file($frameworkPath)) diff --git a/include/runtime b/include/runtime deleted file mode 120000 index df1d4e1..0000000 --- a/include/runtime +++ /dev/null @@ -1 +0,0 @@ -../cache/prado
\ No newline at end of file |