Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f93191f406 |
-14
@@ -12,22 +12,8 @@ python:
|
||||
- 'pypy'
|
||||
|
||||
install:
|
||||
- |
|
||||
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
if [ -f "$PYENV_ROOT/bin/pyenv" ]; then
|
||||
pushd "$PYENV_ROOT" && git pull && popd
|
||||
else
|
||||
rm -rf "$PYENV_ROOT" && git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT"
|
||||
fi
|
||||
export PYPY_VERSION="5.0.1"
|
||||
"$PYENV_ROOT/bin/pyenv" install --skip-existing "pypy-$PYPY_VERSION"
|
||||
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
|
||||
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
|
||||
fi
|
||||
- pip install -e .
|
||||
|
||||
|
||||
before_script:
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install --download-cache $HOME/.pip-cache unittest2; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --download-cache $HOME/.pip-cache coverage; fi;
|
||||
|
||||
@@ -1,27 +1,10 @@
|
||||
## 2.14.1-5
|
||||
|
||||
- fixed two major security issues that caused the examples app to leak information
|
||||
- new Auth(…,host_names=[…]) to prevent host header injection
|
||||
- improved scheduler
|
||||
- pep8 enhancements
|
||||
- many bug fixes
|
||||
- restored GAE support that was broken in 2.13.*
|
||||
- improved fabfile for deployment
|
||||
- refactored examples with stupid.css
|
||||
## trunk
|
||||
- new JWT implementation (experimental)
|
||||
- new gluon.contrib.redis_scheduler
|
||||
- myconf.get
|
||||
- LDAP groups (experimental)
|
||||
- .flash -> .w2p_flash
|
||||
- Updated feedparser.py 5.2.1
|
||||
- Updated jQuery 1.12.2
|
||||
- welcome app now checks for version number
|
||||
- Redis improvements. New syntax:
|
||||
|
||||
- BREAKING: changes to gluon.contrib.redis_cache
|
||||
BEFORE:
|
||||
from gluon.contrib.redis_cache import RedisCache
|
||||
cache.redis = RedisCache('localhost:6379',db=None, debug=True)
|
||||
|
||||
NOW:
|
||||
from gluon.contrib.redis_utils import RConn
|
||||
from gluon.contrib.redis_cache import RedisCache
|
||||
@@ -31,12 +14,11 @@
|
||||
# socket_connect_timeout=None, .....)
|
||||
# exactly as a redis.StrictRedis instance
|
||||
cache.redis = RedisCache(redis_conn=rconn, debug=True)
|
||||
|
||||
- BREAKING: changes to gluon.contrib.redis_session
|
||||
BEFORE:
|
||||
from gluon.contrib.redis_session import RedisSession
|
||||
sessiondb = RedisSession('localhost:6379',db=0, session_expiry=False)
|
||||
session.connect(request, response, db = sessiondb)
|
||||
|
||||
NOW:
|
||||
from gluon.contrib.redis_utils import RConn
|
||||
from gluon.contrib.redis_session import RedisSession
|
||||
@@ -44,9 +26,8 @@
|
||||
sessiondb = RedisSession(redis_conn=rconn, session_expiry=False)
|
||||
session.connect(request, response, db = sessiondb)
|
||||
|
||||
Many thanks to Richard and Simone for their work and dedication.
|
||||
|
||||
## 2.13.*
|
||||
## 2.13.1-2
|
||||
|
||||
- fixed a security issue in request_reset_password
|
||||
- added fabfile.py
|
||||
|
||||
@@ -32,7 +32,7 @@ update:
|
||||
echo "remember that pymysql was tweaked"
|
||||
src:
|
||||
### Use semantic versioning
|
||||
echo 'Version 2.14.5-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
||||
echo 'Version 2.13.4-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
||||
### rm -f all junk files
|
||||
make clean
|
||||
### clean up baisc apps
|
||||
|
||||
@@ -1 +1 @@
|
||||
Version 2.14.5-stable+timestamp.2016.04.13.22.22.13
|
||||
Version 2.13.4-stable+timestamp.2016.02.10.15.41.11
|
||||
|
||||
@@ -268,7 +268,7 @@ def site():
|
||||
raise Exception("404 file not found")
|
||||
except Exception, e:
|
||||
session.flash = \
|
||||
DIV(T('Unable to download app because:'), PRE(repr(e)))
|
||||
DIV(T('Unable to download app because:'), PRE(str(e)))
|
||||
redirect(URL(r=request))
|
||||
fname = form_update.vars.url
|
||||
|
||||
@@ -740,7 +740,7 @@ def edit():
|
||||
B(ex_name), ' ' + T('at line %s', e.lineno),
|
||||
offset and ' ' +
|
||||
T('at char %s', offset) or '',
|
||||
PRE(repr(e)))
|
||||
PRE(str(e)))
|
||||
if data_or_revert and request.args[1] == 'modules':
|
||||
# Lets try to reload the modules
|
||||
try:
|
||||
@@ -751,7 +751,7 @@ def edit():
|
||||
% (request.args[0], mopath)])
|
||||
except Exception, e:
|
||||
response.flash = DIV(
|
||||
T('failed to reload module because:'), PRE(repr(e)))
|
||||
T('failed to reload module because:'), PRE(str(e)))
|
||||
|
||||
edit_controller = None
|
||||
editviewlinks = None
|
||||
|
||||
+104
-340
@@ -2,131 +2,89 @@
|
||||
{
|
||||
'!langcode!': 'cs-cz',
|
||||
'!langname!': 'čeština',
|
||||
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': 'Kolonka "Upravit" je nepovinný výraz, například "pole1=\'nováhodnota\'". (Avšak výsledky databázového JOINu nelze mazat ani upravovat.)',
|
||||
'"User Exception" debug mode. ': '"Uživatelská výjimka", Debug mód.',
|
||||
'"User Exception" debug mode. An error ticket could be issued!': '"Uživatelská výjimka", Debug mód. Může být vystaven chybový tiket.',
|
||||
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': 'Kolonka "Upravit" je nepovinný výraz, například "pole1=\'nováhodnota\'". Výsledky databázového JOINu nemůžete mazat ani upravovat.',
|
||||
'"User Exception" debug mode. An error ticket could be issued!': '"User Exception" debug mode. An error ticket could be issued!',
|
||||
'%%{Row} in Table': '%%{řádek} v tabulce',
|
||||
'%%{Row} selected': 'označených %%{řádek}',
|
||||
'%s': '%s',
|
||||
'%s %%{row} deleted': '%s smazaných %%{záznam}',
|
||||
'%s %%{row} updated': '%s upravených %%{záznam}',
|
||||
'%s selected': '%s označených',
|
||||
'%s students registered': '%s studentů registrováno',
|
||||
'%Y-%m-%d': '%d.%m.%Y',
|
||||
'%Y-%m-%d %H:%M:%S': '%d.%m.%Y %H:%M:%S',
|
||||
'(requires internet access)': '(vyžaduje připojení k internetu)',
|
||||
'(requires internet access, experimental)': '(vyžaduje internetové připojení, experimentální)',
|
||||
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
||||
'(something like "it-it")': '(například "cs-cs")',
|
||||
'(version %s)': '(verze %s)',
|
||||
'?': '?',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(soubor **gluon/contrib/plural_rules/%s.py** nenalezen)',
|
||||
'@markmin\x01An error occured, please [[reload %s]] the page': 'An error occured, please [[reload %s]] the page',
|
||||
'@markmin\x01Searching: **%s** %%{file}': 'Hledání: **%s** %%{soubor}',
|
||||
'Abort': 'Ukončit',
|
||||
'About': 'O programu',
|
||||
'About application': 'O aplikaci',
|
||||
'Accept Terms': 'Souhlasit s podmínkami',
|
||||
'Access Control': 'Řízení přístupu',
|
||||
'Add breakpoint': 'Přidat bod přerušení',
|
||||
'Additional code for your application': 'Další kód pro Vaši aplikaci (pro příkaz import). Neběží ve specifickém režimu ani ve vláknech jako model/kontrolér/šablona, ale jako standardní python moduly. Ty tedy můžete umístit sem (pouze pro tuto aplikaci) nebo používat systémově dostupné.',
|
||||
'Admin design page': 'Admin design stránka',
|
||||
'admin disabled because no admin password': 'admin je zakázán, protože chybí heslo administrátora',
|
||||
'admin disabled because not supported on google app engine': 'admin je zakázán kvůli chybějící podpoře na Google App Engine',
|
||||
'admin disabled because too many invalid login attempts': 'Admin je zakázán po příliš mnoha nesprávných pokusech o přihlášení',
|
||||
'admin disabled because unable to access password file': 'Admin je zakázán, protože nelze číst soubor s heslem',
|
||||
'Admin is disabled because insecure channel': 'Admin je zakázán na nezabezpečeném připojení',
|
||||
'Additional code for your application': 'Další kód pro Vaši aplikaci',
|
||||
'Admin design page': 'Admin design page',
|
||||
'Admin language': 'jazyk rozhraní',
|
||||
'Admin versioning page': 'Admin verzovací stránka',
|
||||
'Administrative interface': 'pro administrátorské rozhraní klikněte sem',
|
||||
'Administrative Interface': 'Administrátorské rozhraní',
|
||||
'administrative interface': 'rozhraní pro správu',
|
||||
'Administrator Password:': 'Administrátorské heslo:',
|
||||
'Ajax Recipes': 'Recepty s ajaxem',
|
||||
'An error occured, please %s the page': 'Došlo k chybě, prosím %s stránku',
|
||||
'An error occured, please %s the page': 'An error occured, please %s the page',
|
||||
'and rename it:': 'a přejmenovat na:',
|
||||
'App does not exist or you are not authorized': 'Aplikace neexistuje nebo vám chybí oprávnění',
|
||||
'appadmin': 'appadmin',
|
||||
'appadmin is disabled because insecure channel': 'appadmin je zakázaná bez zabezpečeného spojení',
|
||||
'Application': 'Aplikace',
|
||||
'Application': 'Application',
|
||||
'application "%s" uninstalled': 'application "%s" odinstalována',
|
||||
'Application cannot be generated in demo mode': 'Aplikace nemůže být vytvořena v demo módu',
|
||||
'application compiled': 'aplikace zkompilována',
|
||||
'Application exists already': 'Aplikace již existuje',
|
||||
'application is compiled and cannot be designed': 'aplikace je přeložena a nelze ji editovat',
|
||||
'Application name:': 'Název aplikace:',
|
||||
'Application updated via git pull': 'Aplikace byla aktualizována pomocí git pull',
|
||||
'are not used': 'nepoužita',
|
||||
'are not used yet': 'ještě nepoužita',
|
||||
'Are you sure you want to delete file "%s"?': 'Skutečně chcete smazat soubor "%s"?',
|
||||
'Are you sure you want to delete plugin "%s"?': 'Skutečně chcete smazat plugin "%s"?',
|
||||
'Are you sure you want to delete this object?': 'Opravdu chcete odstranit tento objekt?',
|
||||
'Are you sure you want to uninstall application "%s"?': 'Opravdu chcete odinstalovat aplikaci "%s"?',
|
||||
'Are you sure?': 'Jste si jist(a)?',
|
||||
'arguments': 'argumenty',
|
||||
'at char %s': 'na pozici znaku %s',
|
||||
'at line %s': 'na řádku %s',
|
||||
'ATTENTION:': 'POZOR:',
|
||||
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': 'POZOR: Přihlášení vyžaduje zabezpečené (HTTPS) připojení nebo spouštění na localhost.',
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'POZOR: TESTOVÁNÍ NENÍ BEZPEČNÉ PŘI SOUBĚŽNÝCH VLÁKNECH. NESPOUŠTĚJ VÍCE TESTŮ SOUBĚŽNĚ.',
|
||||
'ATTENTION: you cannot edit the running application!': 'POZOR: Nelze editovat spuštěnou aplikaci.',
|
||||
'Autocomplete Python Code': 'Autocomplete Python kód',
|
||||
'arguments': 'arguments',
|
||||
'at char %s': 'at char %s',
|
||||
'at line %s': 'at line %s',
|
||||
'ATTENTION:': 'ATTENTION:',
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.',
|
||||
'Available Databases and Tables': 'Dostupné databáze a tabulky',
|
||||
'back': 'zpět',
|
||||
'Back to the plugins list': 'Zpět do seznamu pluginů',
|
||||
'Back to wizard': 'Zpátky do průvodce',
|
||||
'Basics': 'Základy',
|
||||
'Back to wizard': 'Back to wizard',
|
||||
'Basics': 'Basics',
|
||||
'Begin': 'Začít',
|
||||
'breakpoint': 'bod přerušení',
|
||||
'Breakpoints': 'Body přerušení',
|
||||
'breakpoints': 'body přerušení',
|
||||
'Bulk Register': 'Hromadná registrace',
|
||||
'Bulk Student Registration': 'Hromadná registrace studentů',
|
||||
'Buy this book': 'Koupit web2py knihu',
|
||||
'Cache': 'Cache',
|
||||
'cache': 'cache',
|
||||
'Cache Cleared': 'Cache byla vymazána',
|
||||
'Cache Keys': 'Klíče cache',
|
||||
'cache, errors and sessions cleaned': 'cache, chyby a relace byly pročištěny',
|
||||
'can be a git repo': 'může to být git repo',
|
||||
'Cancel': 'Storno',
|
||||
'Cannot be empty': 'Nemůže být prázdné',
|
||||
'Cannot compile: there are errors in your app:': 'Nelze zkompilovat: ve vaší aplikaci jsou chyby:',
|
||||
'cannot create file': 'nelze vytvořit soubor',
|
||||
'cannot upload file "%(filename)s"': 'nelze nahrát soubor "%(filename)s"',
|
||||
'Change Admin Password': 'Změnit heslo pro správu',
|
||||
'Change admin password': 'Změnit heslo pro správu aplikací',
|
||||
'change editor settings': 'změnit nastavení editoru',
|
||||
'Change password': 'Změna hesla',
|
||||
'Changelog': 'Žurnál změn',
|
||||
'check all': 'vše označit',
|
||||
'Check for upgrades': 'Zkusit aktualizovat',
|
||||
'Check to delete': 'Označit ke smazání',
|
||||
'Check to delete:': 'Označit ke smazání:',
|
||||
'Checking for upgrades...': 'Zjišťuji, zda jsou k dispozici aktualizace...',
|
||||
'Clean': 'Pročistit',
|
||||
'Clear': 'Inicializovat',
|
||||
'Clear CACHE?': 'Vymazat CACHE?',
|
||||
'Clear DISK': 'Vymazat DISK',
|
||||
'Clear RAM': 'Vymazat RAM',
|
||||
'Click row to expand traceback': 'Pro rozbalení stopy, klikněte na řádek',
|
||||
'Click row to view a ticket': 'Pro zobrazení chyby (ticketu), klikněte na řádku...',
|
||||
'Client IP': 'IP adresa klienta',
|
||||
'code': 'kód',
|
||||
'Code listing': 'Výpis kódu',
|
||||
'code': 'code',
|
||||
'Code listing': 'Code listing',
|
||||
'collapse/expand all': 'vše sbalit/rozbalit',
|
||||
'Command': 'Příkaz',
|
||||
'Comment:': 'Komentář:',
|
||||
'Commit': 'Potvrdit',
|
||||
'Commit form': 'Potvrdit formulář',
|
||||
'Committed files': 'Potvrzené soubory',
|
||||
'Community': 'Komunita',
|
||||
'Compile': 'Zkompilovat',
|
||||
'Compile (all or nothing)': 'Přeložit (vše nebo nic)',
|
||||
'Compile (skip failed views)': 'Přeložit (přeskočit chybné šablony)',
|
||||
'compiled application removed': 'zkompilovaná aplikace smazána',
|
||||
'Components and Plugins': 'Komponenty a zásuvné moduly',
|
||||
'Condition': 'Podmínka',
|
||||
'continue': 'pokračovat',
|
||||
'continue': 'continue',
|
||||
'Controller': 'Kontrolér (Controller)',
|
||||
'Controllers': 'Kontroléry',
|
||||
'controllers': 'kontroléry',
|
||||
@@ -134,12 +92,9 @@
|
||||
'Count': 'Počet',
|
||||
'Create': 'Vytvořit',
|
||||
'create file with filename:': 'vytvořit soubor s názvem:',
|
||||
'Create/Upload': 'Vytvořit/Nahrát',
|
||||
'created by': 'vytvořil',
|
||||
'Created By': 'Vytvořeno - kým',
|
||||
'Created by:': 'Vytvořil:',
|
||||
'Created On': 'Vytvořeno - kdy',
|
||||
'Created on:': 'Vytvořeno:',
|
||||
'crontab': 'crontab',
|
||||
'Current request': 'Aktuální požadavek',
|
||||
'Current response': 'Aktuální odpověď',
|
||||
@@ -150,19 +105,18 @@
|
||||
'data uploaded': 'data nahrána',
|
||||
'Database': 'Rozhraní databáze',
|
||||
'Database %s select': 'databáze %s výběr',
|
||||
'Database administration': 'Administrace databáze',
|
||||
'Database administration': 'Database administration',
|
||||
'database administration': 'správa databáze',
|
||||
'Database Administration (appadmin)': 'Administrace databáze (appadmin)',
|
||||
'Date and Time': 'Datum a čas',
|
||||
'day': 'den',
|
||||
'db': 'db',
|
||||
'DB Model': 'Databázový model',
|
||||
'Debug': 'Ladění',
|
||||
'defines tables': 'definuje tabulky',
|
||||
'defines tables': 'defines tables',
|
||||
'Delete': 'Smazat',
|
||||
'delete': 'smazat',
|
||||
'delete all checked': 'smazat vše označené',
|
||||
'delete plugin': 'zrušit plugin',
|
||||
'delete plugin': 'delete plugin',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Smazat tento soubor (budete požádán o potvrzení mazání)',
|
||||
'Delete:': 'Smazat:',
|
||||
'deleted after first hit': 'smazat po prvním dosažení',
|
||||
@@ -170,265 +124,166 @@
|
||||
'Deploy': 'Nahrát',
|
||||
'Deploy on Google App Engine': 'Nahrát na Google App Engine',
|
||||
'Deploy to OpenShift': 'Nahrát na OpenShift',
|
||||
'Deploy to pythonanywhere': 'Nahrát na PythonAnywhere',
|
||||
'Deploy to PythonAnywhere': 'Nahrát na PythonAnywhere',
|
||||
'Deployment form': 'Forumlář pro deployment (nasazení)',
|
||||
'Deployment Interface': 'Rozhraní pro deployment (nasazení)',
|
||||
'Deployment Recipes': 'Postupy pro deployment',
|
||||
'Description': 'Popis',
|
||||
'Description:': 'Popis:',
|
||||
'design': 'návrh',
|
||||
'Detailed traceback description': 'Podrobný výpis prostředí',
|
||||
'details': 'podrobnosti',
|
||||
'direction: ltr': 'směr: ltr',
|
||||
'directory not found': 'adresář nebyl nalezen',
|
||||
'Disable': 'Zablokovat',
|
||||
'Disabled': 'Blokováno',
|
||||
'disabled in demo mode': 'zakázáno v demo módu',
|
||||
'disabled in GAE mode': 'zakázáno v GAE módu',
|
||||
'disabled in multi user mode': 'zakázáno ve víceuživatelském módu',
|
||||
'DISK': 'DISK',
|
||||
'Disk Cache Keys': 'Klíče diskové cache',
|
||||
'Disk Cleared': 'Disk smazán',
|
||||
'Display line numbers': 'Zobrazit čísla řádků',
|
||||
'DO NOT use the "Pack compiled" feature.': 'NEPOUŽÍVEJ vlastnost "Zabalit zkompilované".',
|
||||
'docs': 'dokumentace',
|
||||
'Docs': 'Dokumentace',
|
||||
'Documentation': 'Dokumentace',
|
||||
"Don't know what to do?": 'Nevíte kudy kam?',
|
||||
'done!': 'hotovo!',
|
||||
'Downgrade': 'Downgrade (vrácení verze)',
|
||||
'Download': 'Stáhnout',
|
||||
'Download .w2p': 'Stažení .w2p',
|
||||
'Download as .exe': 'Stáhnout jako .exe',
|
||||
'download layouts': 'stáhnout moduly rozvržení stránky',
|
||||
'Download layouts from repository': 'Stáhnout moduly rozvržení z repozitáře',
|
||||
'download plugins': 'stáhnout zásuvné moduly',
|
||||
'Download plugins from repository': 'Stáhnout pluginy z repozitáře',
|
||||
'E-mail': 'E-mail',
|
||||
'Edit': 'Upravit',
|
||||
'edit all': 'editovat vše',
|
||||
'edit all': 'edit all',
|
||||
'Edit application': 'Správa aplikace',
|
||||
'edit controller': 'editovat controller',
|
||||
'edit controller:': 'editovat kontrolér:',
|
||||
'edit controller': 'edit controller',
|
||||
'Edit current record': 'Upravit aktuální záznam',
|
||||
'Edit Profile': 'Upravit profil',
|
||||
'edit views:': 'upravit šablonu (view):',
|
||||
'Editing %s': 'Editace %s',
|
||||
'edit views:': 'upravit pohled:',
|
||||
'Editing file "%s"': 'Úprava souboru "%s"',
|
||||
'Editing Language file': 'Úprava jazykového souboru',
|
||||
'Editing Plural Forms File': 'Editování souboru množných čísel',
|
||||
'Editor': 'Editor',
|
||||
'Email Address': 'Emailová adresa',
|
||||
'Editing Plural Forms File': 'Editing Plural Forms File',
|
||||
'Email and SMS': 'Email a SMS',
|
||||
'Enable': 'Odblokovat',
|
||||
'Enable Close-Tag': 'Povolit Close-Tag',
|
||||
'Enable Code Folding': 'Povolit sdružování kódu',
|
||||
'enter a number between %(min)g and %(max)g': 'zadejte číslo mezi %(min)g a %(max)g',
|
||||
'enter an integer between %(min)g and %(max)g': 'zadejte celé číslo mezi %(min)g a %(max)g',
|
||||
'Error': 'Chyba',
|
||||
'Error logs for "%(app)s"': 'Seznam výskytu chyb pro aplikaci "%(app)s"',
|
||||
'Error snapshot': 'Snapshot chyby',
|
||||
'Error ticket': 'Tiket chyby',
|
||||
'Error ticket': 'Ticket chyby',
|
||||
'Errors': 'Chyby',
|
||||
'Exception %(extype)s: %(exvalue)s': 'Výjimka %(extype)s: %(exvalue)s',
|
||||
'Exception %s': 'Výjimka %s',
|
||||
'Exception %(extype)s: %(exvalue)s': 'Exception %(extype)s: %(exvalue)s',
|
||||
'Exception %s': 'Exception %s',
|
||||
'Exception instance attributes': 'Prvky instance výjimky',
|
||||
'Exit Fullscreen': 'Ukončit režim celé obrazovky',
|
||||
'Expand Abbreviation': 'Rozvinout zkratku',
|
||||
'Expand Abbreviation (html files only)': 'Rozvinout zkratku (pouze html soubory)',
|
||||
'Expand Abbreviation': 'Expand Abbreviation',
|
||||
'export as csv file': 'exportovat do .csv souboru',
|
||||
'Exports:': 'Exporty:',
|
||||
'exposes': 'vystavuje',
|
||||
'exposes:': 'vystavuje funkce:',
|
||||
'extends': 'rozšiřuje',
|
||||
'failed to compile file because:': 'soubor se nepodařilo zkompilovat, protože:',
|
||||
'failed to reload module because:': 'nepodařilo se restartovat modul, protože:',
|
||||
'FAQ': 'Často kladené dotazy',
|
||||
'File': 'Soubor',
|
||||
'file': 'soubor',
|
||||
'file "%(filename)s" created': 'soubor "%(filename)s" byl vytvořen',
|
||||
'file "%(filename)s" deleted': 'soubor "%(filename)s" byl zrušen',
|
||||
'file "%(filename)s" uploaded': 'soubor "%(filename)s" byl nahrán',
|
||||
'file "%s" of %s restored': 'soubor "%s" z %s byl obnoven',
|
||||
'file changed on disk': 'soubor se na disku změnil',
|
||||
'file does not exist': 'soubor neexistuje',
|
||||
'file not found': 'soubor nebyl nalezen',
|
||||
'file "%(filename)s" created': 'file "%(filename)s" created',
|
||||
'file saved on %(time)s': 'soubor uložen %(time)s',
|
||||
'file saved on %s': 'soubor uložen %s',
|
||||
'filename': 'jméno souboru',
|
||||
'Filename': 'Název souboru',
|
||||
'Files added': 'Soubory byly přidány',
|
||||
'filter': 'filtr',
|
||||
'Find Next': 'Najít další',
|
||||
'Find Previous': 'Najít předchozí',
|
||||
'First name': 'Křestní jméno',
|
||||
'Forgot username?': 'Zapomněl jste svoje přihlašovací jméno?',
|
||||
'forgot username?': 'zapomněl jste svoje přihlašovací jméno?',
|
||||
'Form has errors': 'Ve formuláři jsou chyby',
|
||||
'Forms and Validators': 'Formuláře a validátory',
|
||||
'Frames': 'Framy',
|
||||
'Frames': 'Frames',
|
||||
'Free Applications': 'Aplikace zdarma',
|
||||
'Functions with no doctests will result in [passed] tests.': 'Funkce bez doctestů se projeví jako [úspěšný] test.',
|
||||
'GAE Email': 'GAE e-mail',
|
||||
'GAE Output': 'GAE výstup',
|
||||
'GAE Password': 'GAE heslo',
|
||||
'Functions with no doctests will result in [passed] tests.': 'Functions with no doctests will result in [passed] tests.',
|
||||
'Generate': 'Vytvořit',
|
||||
'Get from URL:': 'Stáhnout z internetu:',
|
||||
'Git Pull': 'Git Pull',
|
||||
'Git Push': 'Git Push',
|
||||
'Globals##debug': 'Globální proměnné',
|
||||
'go!': 'OK!',
|
||||
'Google App Engine Deployment Interface': 'Google App Engine - rozhraní pro nasazení',
|
||||
'Google Application Id': 'ID Google Aplikace',
|
||||
'Goto': 'Přejít na',
|
||||
'graph model': 'grafický model',
|
||||
'Graph Model': 'Grafický model',
|
||||
'Goto': 'Goto',
|
||||
'graph model': 'graph model',
|
||||
'Group %(group_id)s created': 'Skupina %(group_id)s vytvořena',
|
||||
'Group ID': 'ID skupiny',
|
||||
'Groups': 'Skupiny',
|
||||
'Hello World': 'Ahoj světe',
|
||||
'Help': 'Nápověda',
|
||||
'here': 'zde',
|
||||
'Hide/Show Translated strings': 'Skrýt/Zobrazit přeložené texty',
|
||||
'Highlight current line': 'Zvýraznit aktuální řádek',
|
||||
'Hits': 'Kolikrát dosaženo',
|
||||
'Home': 'Domovská stránka',
|
||||
'honored only if the expression evaluates to true': 'brát v potaz jen když se tato podmínka vyhodnotí kladně',
|
||||
'How did you get here?': 'Jak jste se sem vlastně dostal?',
|
||||
'If start the downgrade, be patient, it may take a while to rollback': 'Spustíte-li downgrade verze, vyčkejte, protože vrácení změn může trvat dlouho',
|
||||
'If start the upgrade, be patient, it may take a while to download': 'Spustíte-li upgrade, vyčkejte, protože stahování může trvat dlouho',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\n\t\tA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'Jestliže přehled výše obsahuje číslo chybového tiketu, znamená to chybu v kontroléru, ještě před pokusem vykonat doctesty. (Často je to způsobeno chybou odsazení nebo chybou mimo kód funkce.) Zelený nadpis označuje, že žádný test nehavaroval. (V tom případě dílčí výsledky nejsou uvedeny.)',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'Jestliže přehled výše obsahuje číslo chybového tiketu, znamená to chybu v kontroléru, ještě před pokusem vykonat doctesty. (Často je to způsobeno chybou odsazení nebo chybou mimo kód funkce.) Zelený nadpis označuje, že žádný test nehavaroval. (V tom případě dílčí výsledky nejsou uvedeny.)',
|
||||
'if your application uses a database other than sqlite you will then have to configure its DAL in pythonanywhere.': 'Jestliže vaše aplikace používá jinou databázi než SQLite, budete muset na PythonAnywhere konfigurovat její DAL() připojení.',
|
||||
'If start the upgrade, be patient, it may take a while to download': 'If start the upgrade, be patient, it may take a while to download',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
|
||||
'import': 'import',
|
||||
'Import/Export': 'Import/Export',
|
||||
'In development, use the default Rocket webserver that is currently supported by this debugger.': 'Při vývoji je doporučeno použít předvolený webserver Rocket, se kterým tento debugger spolupracuje.',
|
||||
'includes': 'zahrnuje',
|
||||
'Indent with tabs': 'Odsazení tabelátory',
|
||||
'Index': 'Index',
|
||||
'insert new': 'vložit nový záznam ',
|
||||
'insert new %s': 'vložit nový záznam %s',
|
||||
'inspect attributes': 'prohlédnout atributy',
|
||||
'inspect attributes': 'inspect attributes',
|
||||
'Install': 'Instalovat',
|
||||
'Installation of %(plugin)s for %(app)s': 'Instalace %(plugin)s pro %(app)s',
|
||||
'Installed applications': 'Nainstalované aplikace',
|
||||
'Interaction at %s line %s': 'Interakce v %s, na řádce %s',
|
||||
'Interactive console': 'Interaktivní příkazová řádka',
|
||||
'internal error': 'vnitřní chyba',
|
||||
'internal error: %s': 'vnitřní chyba: %s',
|
||||
'Internal State': 'Vnitřní stav',
|
||||
'Introduction': 'Úvod',
|
||||
'Invalid action': 'Chybná akce',
|
||||
'Invalid application name': 'Nesprávné jméno aplikace',
|
||||
'invalid circular reference': 'nepovolený kruhový odkaz',
|
||||
'Invalid email': 'Neplatný email',
|
||||
'Invalid git repository specified.': 'Byl zadán nesprávný git repozitář.',
|
||||
'Invalid password': 'Nesprávné heslo',
|
||||
'invalid password': 'nesprávné heslo',
|
||||
'invalid password.': 'neplatné heslo',
|
||||
'Invalid Query': 'Neplatný dotaz',
|
||||
'invalid request': 'Neplatný požadavek',
|
||||
'Invalid request': 'Nesprávný požadavek (request)',
|
||||
'invalid table names (auth_* tables already defined)': 'chybná jména tabulek (auth_* tabulky už byly definovány)',
|
||||
'invalid ticket': 'chybný tiket',
|
||||
'Is Active': 'Je aktivní',
|
||||
'It is %s %%{day} today.': 'Dnes je to %s %%{den}.',
|
||||
'Key': 'Klíč',
|
||||
'Key bindings': 'Vazby kláves',
|
||||
'Key bindings for ZenCoding Plugin': 'Vazby kláves pro ZenCoding Plugin',
|
||||
'Keyboard shortcuts': 'Klávesové zkratky',
|
||||
'kill process': 'likvidovat proces',
|
||||
'language file "%(filename)s" created/updated': 'jazykový soubor "%(filename)s" byl vytvořen/aktualizován',
|
||||
'Language files (static strings) updated': 'Jazykové soubory (statické řetězce) byly aktualizovány',
|
||||
'Key bindings': 'Vazby klíčů',
|
||||
'Key bindings for ZenCoding Plugin': 'Key bindings for ZenCoding Plugin',
|
||||
'languages': 'jazyky',
|
||||
'Languages': 'Jazyky',
|
||||
'Last name': 'Příjmení',
|
||||
'Last Revision': 'Minulá verze',
|
||||
'Last saved on:': 'Naposledy uloženo:',
|
||||
'Layout': 'Rozvržení stránky (layout)',
|
||||
'Layout Plugins': 'Moduly rozvržení stránky (Layout Plugins)',
|
||||
'Layouts': 'Rozvržení stránek',
|
||||
'License for': 'Licence pro',
|
||||
'License:': 'Licence:',
|
||||
'Line Nr': 'Č.řádku',
|
||||
'Line number': 'Číslo řádku',
|
||||
'LineNo': 'Č.řádku',
|
||||
'lists by exception': 'výpis podle výjimky',
|
||||
'lists by ticket': 'výpis podle tiketu',
|
||||
'Live Chat': 'Online chat',
|
||||
'Loading...': 'Nahrávám...',
|
||||
'Live Chat': 'Online pokec',
|
||||
'loading...': 'nahrávám...',
|
||||
'Local Apps': 'Lokální aplikace',
|
||||
'locals': 'lokální proměnné',
|
||||
'locals': 'locals',
|
||||
'Locals##debug': 'Lokální proměnné',
|
||||
'Logged in': 'Přihlášení proběhlo úspěšně',
|
||||
'Logged out': 'Odhlášení proběhlo úspěšně',
|
||||
'login': 'přihlásit se',
|
||||
'Login': 'Přihlásit se',
|
||||
'Login successful': 'Přihlášení bylo úspěšné',
|
||||
'login': 'přihlásit se',
|
||||
'Login to the Administrative Interface': 'Přihlásit se do Správce aplikací',
|
||||
'Login/Register': 'Přihlásit se / Registrovat',
|
||||
'logout': 'odhlásit se',
|
||||
'Logout': 'Odhlásit se',
|
||||
'lost password': 'ztracené heslo',
|
||||
'Lost Password': 'Zapomněl jste heslo',
|
||||
'Lost password?': 'Zapomněl jste heslo?',
|
||||
'lost password?': 'zapomněl jste heslo?',
|
||||
'Main Menu': 'Hlavní nabídka',
|
||||
'Manage': 'Spravovat',
|
||||
'Manage %(action)s': 'Spravovat %(action)s',
|
||||
'Manage Access Control': 'Spravovat řízení přístupu',
|
||||
'Manage Admin Users/Students': 'Spravovat Admin uživatele / Studenty',
|
||||
'Manage Cache': 'Spravovat cache',
|
||||
'Manage Students': 'Spravovat studenty',
|
||||
'Memberships': 'Členství ve skupinách',
|
||||
'Manage': 'Manage',
|
||||
'Manage Cache': 'Manage Cache',
|
||||
'Menu Model': 'Model rozbalovací nabídky',
|
||||
'merge': 'sloučit',
|
||||
'Models': 'Modely',
|
||||
'models': 'modely',
|
||||
'Modified By': 'Změněno - kým',
|
||||
'Modified On': 'Změněno - kdy',
|
||||
'Modules': 'Moduly',
|
||||
'modules': 'moduly',
|
||||
'Multi User Mode': 'Víceuživatelský mód',
|
||||
'My Sites': 'Správa aplikací',
|
||||
'Name': 'Jméno',
|
||||
'new application "%s" created': 'nová aplikace "%s" vytvořena',
|
||||
'new application "%s" imported': 'nová aplikace "%s" byla importována',
|
||||
'New Application Wizard': 'Nový průvodce aplikací',
|
||||
'New application wizard': 'Nový průvodce aplikací',
|
||||
'New password': 'Nové heslo',
|
||||
'new plugin installed': 'nový plugin byl instalován',
|
||||
'New plugin installed: %s': 'Nový plugin byl instalován: %s',
|
||||
'New Record': 'Nový záznam',
|
||||
'new record inserted': 'nový záznam byl založen',
|
||||
'New simple application': 'Vytvořit novou aplikaci',
|
||||
'next': 'další',
|
||||
'next %s rows': 'dalších %s řádků',
|
||||
'New simple application': 'Vytvořit primitivní aplikaci',
|
||||
'next': 'next',
|
||||
'next 100 rows': 'dalších 100 řádků',
|
||||
'NO': 'NE',
|
||||
'no changes': 'beze změn',
|
||||
'No databases in this application': 'V této aplikaci nejsou žádné databáze',
|
||||
'No Interaction yet': 'Ještě žádná interakce nenastala',
|
||||
'no match': 'nenalezena shoda',
|
||||
'no package selected': 'nebyla vybrána žádná package',
|
||||
'no permission to uninstall "%s"': 'chybí oprávnění odinstalovat "%s"',
|
||||
'No ticket_storage.txt found under /private folder': 'Soubor ticket_storage.txt v adresáři /private nenalezen',
|
||||
'Node:': 'Uzel (node):',
|
||||
'Not Authorized': 'Chybí autorizace',
|
||||
'Not supported': 'Není podporováno',
|
||||
'Note: If you receive an error with github status code of 128, ensure the system and account you are deploying from has a cooresponding ssh key configured in the openshift account.': 'Poznámka: Dostanete-li chybu s github status code = 128, ujistěte se, že systém a účet z něhož provádíte nasazení má odpovídající ssh klíč, konfigurovaný v OpenShift účtu.',
|
||||
'Object or table name': 'Objekt či tabulka',
|
||||
'Old password': 'Původní heslo',
|
||||
"On production, you'll have to configure your webserver to use one process and multiple threads to use this debugger.": 'Pro použití tohoto debuggeru na produkci je potřeba konfigurovat webserver, aby používal jeden proces a více vláken.',
|
||||
'online designer': 'online návrhář',
|
||||
'Online examples': 'Příklady online',
|
||||
'Open new app in new window': 'Otevřít novou aplikaci v novém okně',
|
||||
'OpenShift Deployment Interface': 'OpenShift rozhraní pro nasazení aplikace',
|
||||
'OpenShift Output': 'OpenShift výstup',
|
||||
'or alternatively': 'nebo případně',
|
||||
'Or Get from URL:': 'Nebo získat z URL adresy:',
|
||||
'Open new app in new window': 'Open new app in new window',
|
||||
'or alternatively': 'or alternatively',
|
||||
'Or Get from URL:': 'Or Get from URL:',
|
||||
'or import from csv file': 'nebo importovat z .csv souboru',
|
||||
'Origin': 'Původ',
|
||||
'Original/Translation': 'Originál/Překlad',
|
||||
@@ -438,53 +293,30 @@
|
||||
'Overwrite installed app': 'Přepsat instalovanou aplikaci',
|
||||
'Pack all': 'Zabalit',
|
||||
'Pack compiled': 'Zabalit zkompilované',
|
||||
'Pack custom': 'Zabalit volitelně (custom)',
|
||||
'pack plugin': 'zabalit plugin',
|
||||
'Password': 'Heslo',
|
||||
'pack plugin': 'pack plugin',
|
||||
'password': 'heslo',
|
||||
'password changed': 'heslo bylo změněno',
|
||||
'Password': 'Heslo',
|
||||
"Password fields don't match": 'Hesla se neshodují',
|
||||
'Past revisions': 'Minulá verze',
|
||||
'Path to appcfg.py': 'Cesta ke appcfg.py',
|
||||
'Path to local openshift repo root.': 'Cesta ke kořenu (rootu) lokálního OpenShift repozitáře.',
|
||||
'Peeking at file': 'Sledování souboru',
|
||||
'Permission': 'Oprávnění',
|
||||
'Permissions': 'Oprávnění',
|
||||
'Peeking at file': 'Peeking at file',
|
||||
'Please': 'Prosím',
|
||||
'Please wait, giving pythonanywhere a moment...': 'Prosím, čekejte na dokončení činnosti PythonAnywhere...',
|
||||
'plugin "%(plugin)s" deleted': 'plugin "%(plugin)s" byl odstraněn',
|
||||
'Plugin "%s" in application': 'Plugin "%s" v aplikaci',
|
||||
'plugin not specified': 'plugin nebyl určen',
|
||||
'Plugin page': 'Stránka pluginů',
|
||||
'Plugin "%s" in application': 'Plugin "%s" in application',
|
||||
'plugins': 'zásuvné moduly',
|
||||
'Plugins': 'Zásuvné moduly',
|
||||
'Plural Form #%s': 'Množné číslo #%s',
|
||||
'Plural Form #%s': 'Plural Form #%s',
|
||||
'Plural-Forms:': 'Množná čísla:',
|
||||
'Powered by': 'používá technologii',
|
||||
'Powered by': 'Poháněno',
|
||||
'Preface': 'Předmluva',
|
||||
'Preferences saved correctly': 'Nastavení byla úspěšně uložena',
|
||||
'Preferences saved on session only': 'Nastavení byla uložena pouze pro toto sezení',
|
||||
'previous %s rows': 'předchozích %s řádků',
|
||||
'previous 100 rows': 'předchozích 100 řádků',
|
||||
'Private files': 'Soukromé soubory',
|
||||
'private files': 'soukromé soubory',
|
||||
'profile': 'profil',
|
||||
'Project Progress': 'Vývoj projektu',
|
||||
'Pull': 'Pull',
|
||||
'Pull failed, certain files could not be checked out. Check logs for details.': 'Pull selhal, některé soubory nelze zkopírovat. Pro podrobnosti zkontrolujte logy.',
|
||||
'Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.': 'Pull nelze provést, protože máte nesloučené soubory. Vyřešte tyto konflikty a pak akci opakujte.',
|
||||
'Push': 'Push',
|
||||
'Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.': 'Push selhal, protože máte nesloučené soubory. Vyřešte tyto konflikty a pak akci opakujte.',
|
||||
'pygraphviz library not found': 'pygraphviz knihovna nebyla nalezena',
|
||||
'Python': 'Python',
|
||||
'PythonAnywhere Apps': 'PythonAnywhere aplikace',
|
||||
'PythonAnywhere Password': 'PythonAnywhere heslo',
|
||||
'Query:': 'Dotaz:',
|
||||
'Quick Examples': 'Krátké příklady',
|
||||
'RAM': 'RAM',
|
||||
'RAM Cache Keys': 'Klíče RAM Cache',
|
||||
'Ram Cleared': 'RAM smazána',
|
||||
'Rapid Search': 'Rychlé hledání',
|
||||
'Readme': 'Nápověda',
|
||||
'Recipes': 'Postupy jak na to',
|
||||
'Record': 'Záznam',
|
||||
@@ -503,167 +335,114 @@
|
||||
'Removed Breakpoint on %s at line %s': 'Bod přerušení smazán - soubor %s na řádce %s',
|
||||
'Replace': 'Zaměnit',
|
||||
'Replace All': 'Zaměnit vše',
|
||||
'Repository (%s)': 'Repozitář (%s)',
|
||||
'request': 'požadavek (request)',
|
||||
'requires distutils, but not installed': 'vyžaduje distutils, jenže ty nejsou instalovány',
|
||||
'requires python-git, but not installed': 'vyžaduje python-git, který ale není nainstalován',
|
||||
'request': 'request',
|
||||
'Reset Password key': 'Reset registračního klíče',
|
||||
'Resolve Conflict file': 'Vyřešit konflikty',
|
||||
'response': 'odpověď (response)',
|
||||
'response': 'response',
|
||||
'restart': 'restart',
|
||||
'restore': 'obnovit',
|
||||
'Retrieve username': 'Získat přihlašovací jméno',
|
||||
'return': 'return',
|
||||
'Revert': 'Vrátit se k původnímu',
|
||||
'revert': 'vrátit se k původnímu',
|
||||
'reverted to revision %s': 'vráceno k verzi %s',
|
||||
'Revision %s': 'Verze %s',
|
||||
'Revision:': 'Verze:',
|
||||
'Role': 'Role',
|
||||
'Roles': 'Role',
|
||||
'Rows in Table': 'Záznamy v tabulce',
|
||||
'Rows selected': 'Záznamů zobrazeno',
|
||||
'rules are not defined': 'pravidla nejsou definována',
|
||||
'Run tests': 'Spustit testy',
|
||||
'Run tests in this file': 'Spustit testy v souboru',
|
||||
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Spustí testy v tomto souboru (ke spuštění všech testů, použijte tlačítko 'test')",
|
||||
'Running on %s': 'Běží na %s',
|
||||
'Save': 'Uložit',
|
||||
'Save file:': 'Uložit soubor:',
|
||||
'Save file: %s': 'Uložit soubor: %s',
|
||||
'Save model as...': 'Uložit model jako...',
|
||||
'Save file:': 'Save file:',
|
||||
'Save via Ajax': 'Uložit pomocí Ajaxu',
|
||||
'Saved file hash:': 'hash uloženého souboru:',
|
||||
'Screenshot %s': 'Screenshot %s',
|
||||
'Search': 'Hledání',
|
||||
'Select Files to Package': 'Vybrat soubory pro package',
|
||||
'Semantic': 'Modul semantic',
|
||||
'Services': 'Služby',
|
||||
'session': 'session (sezení)',
|
||||
'session expired': 'vypršela session',
|
||||
'Session saved correctly': 'Session byla úspěšně uložena',
|
||||
'Session saved on session only': 'Session byla uložena jen pro toto sezení',
|
||||
'session': 'session',
|
||||
'session expired': 'session expired',
|
||||
'Set Breakpoint on %s at line %s: %s': 'Bod přerušení nastaven v souboru %s na řádce %s: %s',
|
||||
'shell': 'příkazová řádka',
|
||||
'Showing %s to %s of %s %s found': 'Zobrazuji %s až %s z %s %s nalezených',
|
||||
'Singular Form': 'Jednotné číslo',
|
||||
'Singular Form': 'Singular Form',
|
||||
'Site': 'Správa aplikací',
|
||||
'Size of cache:': 'Velikost cache:',
|
||||
'skip to generate': 'přeskočit pro vytvoření',
|
||||
'some files could not be removed': 'některé soubory nelze odstranit',
|
||||
'Something went wrong please wait a few minutes before retrying': 'Něco se nepodařilo. Vyčkejte několik minut a pak zkuste znova',
|
||||
'skip to generate': 'skip to generate',
|
||||
'Sorry, could not find mercurial installed': 'Bohužel mercurial není nainstalován.',
|
||||
'source : db': 'zdroj : db',
|
||||
'source : filesystem': 'zdroj : souborový systém',
|
||||
'Start a new app': 'Vytvořit novou aplikaci',
|
||||
'Start searching': 'Začít hledání',
|
||||
'Start wizard': 'Spustit průvodce',
|
||||
'state': 'stav',
|
||||
'Static': 'Statické soubory',
|
||||
'Static': 'Static',
|
||||
'static': 'statické soubory',
|
||||
'Static files': 'Statické soubory',
|
||||
'Statistics': 'Statistika',
|
||||
'Step': 'Krok',
|
||||
'step': 'krok',
|
||||
'stop': 'zastavit',
|
||||
'Step': 'Step',
|
||||
'step': 'step',
|
||||
'stop': 'stop',
|
||||
'Stylesheet': 'CSS styly',
|
||||
'submit': 'odeslat',
|
||||
'Submit': 'Odeslat',
|
||||
'successful': 'úspěšně',
|
||||
'Support': 'Podpora',
|
||||
'Sure you want to delete this object?': 'Opravdu chcete smazat tento objekt?',
|
||||
'switch to : db': 'přepnout na : db',
|
||||
'switch to : filesystem': 'přepnout na : souborový systém',
|
||||
'Tab width (# characters)': 'Šířka tabelátoru (# znaků)',
|
||||
'Table': 'tabulka',
|
||||
'Table name': 'Název tabulky',
|
||||
'Temporary': 'Dočasný',
|
||||
'test': 'test',
|
||||
'Testing application': 'Zkušební aplikace',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': '"Dotaz" je například "db.tabulka1.pole1==\'hodnota\'". Dotaz se dvěma tabulkami "db.tabulka1.pole1==db.tabulka2.pole2" vytvoří SQL JOIN.',
|
||||
'The app exists, was created by wizard, continue to overwrite!': 'Aplikace existuje, byla vytvořena průvodcem. Pokračováním ji přepíšete !',
|
||||
'The app exists, was NOT created by wizard, continue to overwrite!': 'Aplikace existuje, a NEBYLA vytvořena průvodcem. Pokračováním ji přepíšete !',
|
||||
'Testing application': 'Testing application',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': '"Dotaz" je podmínka, například "db.tabulka1.pole1==\'hodnota\'". Podmínka "db.tabulka1.pole1==db.tabulka2.pole2" pak vytvoří SQL JOIN.',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'Logika aplikace: každá URL je mapována na funkci vystavovanou kontrolérem.',
|
||||
'The Core': 'Jádro (The Core)',
|
||||
'The data representation, define database tables and sets': 'Modely se vykonají při každém přístupu. Zde se obvykle definuje především reprezentace dat: Připojení k databázi a struktura tabulek databáze',
|
||||
'The output of the file is a dictionary that was rendered by the view %s': 'Výstup ze souboru je dictionary (slovník), který se zobrazil pomocí šablony (view) %s.',
|
||||
'The presentations layer, views are also known as templates': 'Prezentační vrstva: šablony (neboli pohledy, templaty, view). Mixuje Html, Python kód a Python data.',
|
||||
'The data representation, define database tables and sets': 'Reprezentace dat: definovat tabulky databáze a záznamy',
|
||||
'The output of the file is a dictionary that was rendered by the view %s': 'Výstup ze souboru je slovník, který se zobrazil v pohledu %s.',
|
||||
'The presentations layer, views are also known as templates': 'Prezentační vrstva: pohledy či templaty (šablony)',
|
||||
'The Views': 'Pohledy (The Views)',
|
||||
'Theme': 'Téma',
|
||||
'There are no controllers': 'Nejsou vytvořeny žádné controllery',
|
||||
'There are no models': 'Není vytvořen žádný model',
|
||||
'There are no modules': 'Nejsou přidány žádné moduly',
|
||||
'There are no controllers': 'There are no controllers',
|
||||
'There are no modules': 'There are no modules',
|
||||
'There are no plugins': 'Žádné moduly nejsou instalovány.',
|
||||
'There are no private files': 'Žádné soukromé soubory neexistují.',
|
||||
'There are no static files': 'Nejsou přidány žádné statické soubory',
|
||||
'There are no translators': 'Není vytvořen žádný překlad',
|
||||
'There are no translators, only default language is supported': 'Není vytvořen žádný překlad, je podporován jen defaultní jazyk',
|
||||
'There are no views': 'Nejsou vytvořeny žádné šablony (views)',
|
||||
'These files are not served, they are only available from within your app': 'Tyto soubory jsou přístupné jen běžící aplikaci. Nejsou dostupné uživatelům, ani se nekopírují do případného vývojového repozitáře. Hesla a citlivá nastavení nedávejte nikam jinam.',
|
||||
'These files are served without processing, your images go here': 'Tyto soubory jsou stahovány přímo, bez jakékoli přídavné logiky, sem patří např. obrázky.',
|
||||
'There are no static files': 'There are no static files',
|
||||
'There are no translators, only default language is supported': 'There are no translators, only default language is supported',
|
||||
'There are no views': 'There are no views',
|
||||
'These files are not served, they are only available from within your app': 'Tyto soubory jsou klientům nepřístupné. K dispozici jsou pouze v rámci aplikace.',
|
||||
'These files are served without processing, your images go here': 'Tyto soubory jsou servírovány bez přídavné logiky, sem patří např. obrázky.',
|
||||
'This App': 'Tato aplikace',
|
||||
"This debugger may not work properly if you don't have a threaded webserver or you're using multiple daemon processes.": 'Tento debugger nebude pracovat správně, jestliže váš webový server nepracuje pomocí vláken nebo když používáte více procesů démonů.',
|
||||
'This is a copy of the scaffolding application': 'Toto je kopie vzorové aplikace.',
|
||||
'This is an experimental feature and it needs more testing. If you decide to downgrade you do it at your own risk': 'Toto je experimentální vlastnost, která vyžaduje další testování. Návrat verze jen na vlastní riziko.',
|
||||
'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk': 'Toto je experimentální vlastnost, která vyžaduje další testování. Upgrade verze jen na vlastní riziko.',
|
||||
'This is the %(filename)s template': 'Toto je šablona %(filename)s',
|
||||
"This page can commit your changes to an openshift app repo and push them to your cloud instance. This assumes that you've already created the application instance using the web2py skeleton and have that repo somewhere on a filesystem that this web2py instance can access. This functionality requires GitPython installed and on the python path of the runtime that web2py is operating in.": 'Tato stránka umožňuje potvrdit vaše změny do OpenShift aplikačního repozitáře a odeslat je do vaší cloud instance. Předpokladem je, že jste už vytvořili aplikační instanci pomocí Web2py předlohy a že tento repozitář máte někde na disku tak, aby k němu Web2py mělo přístup. Tato funkcionalita vyžaduje, aby byl instalován GitPython a aby mohl být nalezen pomocí cesty, se kterou Web2py pracuje.',
|
||||
'This page can upload your application to the Google App Engine computing cloud. Mind that you must first create indexes locally and this is done by installing the Google appserver and running the app locally with it once, or there will be errors when selecting records. Attention: deployment may take long time, depending on the network speed. Attention: it will overwrite your app.yaml. DO NOT SUBMIT TWICE.': 'Tato stránka umožňuje zkopírovat vaši aplikaci do Google App Engine cloudu. Pamatujte, že nejprve je třeba vytvořit indexy lokálně, čehož dosáhnete instalací Google appserver a jedním lokálním spuštěním aplikace. V opačném případě bude docházet k chybám vyhledávání. Pozor: v závislosti na rychlosti sítě může nasazení trvat dlouhou dobu. Pozor: bude přepsán váš soubor app.yaml. BĚHEM SPUŠTĚNÍ NESPOUŠTĚJTE PODRUHÉ.',
|
||||
'This is a copy of the scaffolding application': 'Toto je kopie aplikace skelet.',
|
||||
'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk': 'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk',
|
||||
'This is the %(filename)s template': 'This is the %(filename)s template',
|
||||
'this page to see if a breakpoint was hit and debug interaction is required.': 'tuto stránku, abyste uviděli, zda se dosáhlo bodu přerušení.',
|
||||
'This will pull changes from the remote repo for application "%s"?': 'Toto stáhne (pull) změny ze vzdáleného repozitáře pro aplikaci "%s"?',
|
||||
'This will push changes to the remote repo for application "%s".': 'Toto nahraje (push) změny do vzdáleného repozitáře pro aplikaci "%s".',
|
||||
'Ticket': 'Tiket',
|
||||
'Ticket ID': 'ID tiketu',
|
||||
'Ticket Missing': 'Chybový tiket chybí',
|
||||
'Ticket': 'Ticket',
|
||||
'Ticket ID': 'Ticket ID',
|
||||
'Time in Cache (h:m:s)': 'Čas v Cache (h:m:s)',
|
||||
'Timestamp': 'Časové razítko',
|
||||
'to previous version.': 'k předchozí verzi.',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Zásuvný modul vytvoříte tak, že pojmenujete skupinu souborů nebo adresář(e) plugin_[jméno modulu]',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Zásuvný modul vytvoříte tak, že pojmenujete soubor/adresář plugin_[jméno modulu]',
|
||||
'To emulate a breakpoint programatically, write:': 'K nastavení bodu přerušení v kódu programu, napište:',
|
||||
'to use the debugger!': ', abyste mohli ladící program používat!',
|
||||
'toggle breakpoint': 'vyp./zap. bod přerušení',
|
||||
'Toggle comment': 'Přepnout komentář',
|
||||
'Toggle Fullscreen': 'Na celou obrazovku a zpět',
|
||||
'too short': 'Příliš krátké',
|
||||
'Traceback': 'Hierarchie volání',
|
||||
'Traceback': 'Traceback',
|
||||
'Translation strings for the application': 'Překlad textů pro aplikaci',
|
||||
'try something like': 'zkuste něco jako',
|
||||
'try something like': 'try something like',
|
||||
'Try the mobile interface': 'Zkuste rozhraní pro mobilní zařízení',
|
||||
'try view': 'vyzkoušet šablonu (view)',
|
||||
'try view': 'try view',
|
||||
'Twitter': 'Twitter',
|
||||
'Type PDB debugger command in here and hit Return (Enter) to execute it.': 'Zapište příkaz PDB debuggeru a stiskněte Return (Enter) pro jeho provedení.',
|
||||
'Type python statement in here and hit Return (Enter) to execute it.': 'Zapište příkaz pythonu a stiskněte Return (Enter) pro jeho provedení.',
|
||||
'Type some Python code in here and hit Return (Enter) to execute it.': 'Zapište kód v jazyce python a stiskněte Return (Enter) pro jeho provedení.',
|
||||
'Unable to check for upgrades': 'Nelze zjistit informaci o aktualizacích',
|
||||
'unable to create application "%s"': 'nelze vytvořit aplikaci "%s"',
|
||||
'unable to delete file "%(filename)s"': 'nelze zrušit soubor "%(filename)s"',
|
||||
'unable to delete file plugin "%(plugin)s"': 'nelze zrušit plugin "%(plugin)s"',
|
||||
'Unable to determine the line number!': 'Nelze určit číslo řádky!',
|
||||
'Unable to download app because:': 'Nelze stáhnout aplikaci, protože:',
|
||||
'unable to download layout': 'nelze stáhnout šablonu (layout)',
|
||||
'unable to download plugin: %s': 'nelze stáhnout plugin: %s',
|
||||
'Unable to download the list of plugins': 'Nelze stáhnout seznam pluginů',
|
||||
'unable to install plugin "%s"': 'nelze instalovat plugin "%s"',
|
||||
'Type python statement in here and hit Return (Enter) to execute it.': 'Type python statement in here and hit Return (Enter) to execute it.',
|
||||
'Type some Python code in here and hit Return (Enter) to execute it.': 'Type some Python code in here and hit Return (Enter) to execute it.',
|
||||
'Unable to check for upgrades': 'Unable to check for upgrades',
|
||||
'unable to parse csv file': 'csv soubor nedá sa zpracovat',
|
||||
'unable to uninstall "%s"': 'nelze instalovat "%s"',
|
||||
'unable to upgrade because "%s"': 'nelze upgradovat, protože "%s"',
|
||||
'uncheck all': 'vše odznačit',
|
||||
'Uninstall': 'Odinstalovat',
|
||||
'Unsupported webserver working mode: %s': 'Nepodporovaný mód webového serveru: %s',
|
||||
'update': 'aktualizovat',
|
||||
'update all languages': 'aktualizovat všechny jazyky o nové texty ze zdrojových souborů',
|
||||
'update all languages': 'aktualizovat všechny jazyky',
|
||||
'Update:': 'Upravit:',
|
||||
'Upgrade': 'Upgrade',
|
||||
'upgrade now': 'upgradovat nyní',
|
||||
'upgrade now to %s': 'upgradovat nyní na %s',
|
||||
'upgrade now': 'upgrade now',
|
||||
'upgrade now to %s': 'upgrade now to %s',
|
||||
'upload': 'nahrát',
|
||||
'Upload': 'Upload (nahrát)',
|
||||
'Upload': 'Upload',
|
||||
'Upload a package:': 'Nahrát balík:',
|
||||
'Upload and install packed application': 'Nahrát a instalovat zabalenou aplikaci',
|
||||
'upload file:': 'nahrát soubor:',
|
||||
'upload plugin file:': 'nahrát soubor modulu:',
|
||||
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Použijte (...)&(...) pro AND, (...)|(...) pro OR a ~(...) pro NOT pro sestavení složitějších dotazů.',
|
||||
'User': 'Uživatel',
|
||||
'User %(id)s Logged-in': 'Uživatel %(id)s přihlášen',
|
||||
'User %(id)s Logged-out': 'Uživatel %(id)s odhlášen',
|
||||
'User %(id)s Password changed': 'Uživatel %(id)s změnil heslo',
|
||||
@@ -672,45 +451,30 @@
|
||||
'User %(id)s Username retrieved': 'Uživatel %(id)s si nachal zaslat přihlašovací jméno',
|
||||
'User ID': 'ID uživatele',
|
||||
'Username': 'Přihlašovací jméno',
|
||||
'Users': 'Uživatelé',
|
||||
'Using the shell may lock the database to other users of this app.': 'Použití příkazového shellu může uzamknout databázi ostatním uživatelům této aplikace.',
|
||||
'variables': 'proměnné',
|
||||
'variables': 'variables',
|
||||
'Verify Password': 'Zopakujte heslo',
|
||||
'Version': 'Verze',
|
||||
'Version %s.%s.%s (%s) %s': 'Verze %s.%s.%s (%s) %s',
|
||||
'Versioning': 'Verzování',
|
||||
'Videos': 'Videa',
|
||||
'View': 'Šablona (View)',
|
||||
'Views': 'Šablony (Views)',
|
||||
'views': 'šablony (views)',
|
||||
'Warning!': 'Pozor!',
|
||||
'WARNING:': 'POZOR:',
|
||||
'WARNING: The following views could not be compiled:': 'POZOR: Následující šablony se nepodařilo zkompilovat:',
|
||||
'Web Framework': 'Webový framework',
|
||||
'web2py Admin Password': 'web2py Heslo administrátora',
|
||||
'web2py apps to deploy': 'web2py aplikace k nasazení',
|
||||
'web2py Debugger': 'web2py Debugger',
|
||||
'web2py downgrade': 'web2py downgrade',
|
||||
'View': 'Pohled (View)',
|
||||
'Views': 'Pohledy',
|
||||
'views': 'pohledy',
|
||||
'Web Framework': 'Web Framework',
|
||||
'web2py is up to date': 'Máte aktuální verzi web2py.',
|
||||
'web2py online debugger': 'Ladící online web2py program',
|
||||
'web2py Recent Tweets': 'Nedávné tweety na Twitteru o web2py',
|
||||
'web2py upgrade': 'aktualizace Web2py',
|
||||
'web2py upgraded; please restart it': 'Web2py bylo aktualizováno; prosím restarujte jej',
|
||||
'web2py Recent Tweets': 'Štěbetání na Twitteru o web2py',
|
||||
'web2py upgrade': 'web2py upgrade',
|
||||
'web2py upgraded; please restart it': 'web2py upgraded; please restart it',
|
||||
'Welcome': 'Vítejte',
|
||||
'Welcome to web2py': 'Vitejte ve Web2py aplikaci.',
|
||||
'Welcome to web2py!': 'Vítejte ve Web2py aplikaci.',
|
||||
'Welcome to web2py': 'Vitejte ve web2py',
|
||||
'Welcome to web2py!': 'Vítejte ve web2py!',
|
||||
'Which called the function %s located in the file %s': 'která zavolala funkci %s v souboru (kontroléru) %s.',
|
||||
'WSGI reference name': 'jméno WSGI reference',
|
||||
'YES': 'ANO',
|
||||
'Yes': 'Ano',
|
||||
'You are successfully running web2py': 'Úspěšně jste spustili web2py.',
|
||||
'You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button': 'Nastavovat a mazat body přerušení je též možno v rámci editování zdrojového souboru přes tlačítko Vyp./Zap. bod přerušení',
|
||||
'You can inspect variables using the console bellow': 'Níže pomocí příkazové řádky si můžete prohlédnout proměnné',
|
||||
'You can inspect variables using the console below': 'You can inspect variables using the console below',
|
||||
'You can modify this application and adapt it to your needs': 'Tuto aplikaci si můžete upravit a přizpůsobit ji svým potřebám.',
|
||||
'You have one more login attempt before you are locked out': 'Máte jen jeden další pokus k přihlášení před zablokováním',
|
||||
'You need to set up and reach a': 'Je třeba nejprve nastavit a dojít až na',
|
||||
'You only need these if you have already registered': 'Toto potřebujete jen tehdy, jestliže jste se už registroval(a)',
|
||||
'You visited the url %s': 'Navštívili jste stránku %s,',
|
||||
'Your application will be blocked until you click an action button (next, step, continue, etc.)': 'Aplikace bude blokována než se klikne na jedno z tlačítek (další, krok, pokračovat, atd.)',
|
||||
'You can inspect variables using the console bellow': 'Níže pomocí příkazové řádky si můžete prohlédnout proměnné',
|
||||
}
|
||||
|
||||
@@ -12,29 +12,24 @@ def button(href, label):
|
||||
if is_mobile:
|
||||
ret = A_button(SPAN(label), _href=href)
|
||||
else:
|
||||
ret = A(SPAN(label), _class='button btn', _href=href)
|
||||
ret = A(SPAN(label), _class='btn rounded', _href=href)
|
||||
return ret
|
||||
|
||||
def button_enable(href, app):
|
||||
if os.path.exists(os.path.join(apath(app, r=request), 'DISABLED')):
|
||||
label = SPAN(T('Enable'), _style='color:red')
|
||||
text, classes = T("Enable"), "btn rounded red"
|
||||
else:
|
||||
label = SPAN(T('Disable'), _style='color:green')
|
||||
text, classes = T("Disable"), "btn rounded gree"
|
||||
id = 'enable_' + app
|
||||
return A(label, _class='button btn', _id=id, callback=href, target=id)
|
||||
return A(text, _class=classes, _id=id, callback=href, target=id)
|
||||
|
||||
def sp_button(href, label):
|
||||
if request.user_agent().get('is_mobile'):
|
||||
ret = A_button(SPAN(label), _href=href)
|
||||
else:
|
||||
ret = A(SPAN(label), _class='button special btn btn-inverse', _href=href)
|
||||
ret = A(SPAN(label), _class='btn pink rounded', _href=href)
|
||||
return ret
|
||||
|
||||
def helpicon():
|
||||
return IMG(_src=URL('static', 'images/help.png'), _alt='help')
|
||||
|
||||
def searchbox(elementid):
|
||||
return SPAN(LABEL(IMG(_id="search_start", _src=URL('static', 'images/search.png'), _alt=T('filter')),
|
||||
_class='icon', _for=elementid), ' ',
|
||||
INPUT(_id=elementid, _type='text', _size=12, _class="input-medium"),
|
||||
_class="searchbox")
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,489 +0,0 @@
|
||||
|
||||
/*=============================================================
|
||||
GENERAL
|
||||
==============================================================*/
|
||||
body { /*remember to account for the hidden area underneath
|
||||
fixed navbar by adding at least 40px padding to the <body>.
|
||||
Be sure to add this after the core Bootstrap CSS
|
||||
and before the optional responsive CSS.
|
||||
An alternative solution is to set top-margin to div#main padding-top:60px; comment this for alternative solution*/ height:auto; /*uncomment this for alternative solution*/ }
|
||||
|
||||
/*=============================================================
|
||||
BOOTSTRAP ICONS FOLDER FIX
|
||||
==============================================================*/
|
||||
[class^="icon-"], [class*=" icon-"] { /* right folder for bootstrap black images/icons*/ background-image:url("../images/glyphicons-halflings.png") }
|
||||
|
||||
.icon-white, .nav-tabs>.active >a>[class^="icon-"], .nav-tabs>.active>a>[class*=" icon-"], .nav-pills>.active>a>[class^="icon-"], .nav-pills>.active>a>[class*=" icon-"], .nav-list>.active>a>[class^="icon-"], .nav-list>.active>a>[class*=" icon-"], .navbar-inverse .nav>.active>a>[class^="icon-"], .navbar-inverse .nav>.active>a>[class*=" icon-"], .dropdown-menu>li>a:hover>[class^="icon-"], .dropdown-menu>li>a:hover>[class*=" icon-"], .dropdown-menu>.active>a>[class^="icon-"], .dropdown-menu>.active>a>[class*=" icon-"] { /* right folder for bootstrap white images/icons*/ background-image:url("../images/glyphicons-halflings-white.png"); }
|
||||
|
||||
/*=============================================================
|
||||
INPUT BORDER HIGHLIGHT WHEN INPUT IS FOCUSED
|
||||
==============================================================*/
|
||||
textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="color"]:focus, input[type="file"]:focus, select:focus, .uneditable-input:focus { /* outline color*/ border-color:rgba(232, 149, 60, 0.8); outline:0; /*outline:thin dotted \9;*/ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(232, 149, 60, 0.6); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(232, 149, 60, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(232, 149, 60, 0.6); }
|
||||
|
||||
.web2py_grid .dropdown-menu li > a:hover, .web2py_grid .dropdown-menu li > a:focus { filter:progid:DXImageTransform.Microsoft.gradient(enabled=false); /* IE6-9*/ background-image:none; background-color:#E8953C; }
|
||||
|
||||
/*=============================================================
|
||||
COLOR OF LINKS
|
||||
==============================================================*/
|
||||
a, a:hover { color:#E8953C; text-decoration:none; }
|
||||
|
||||
a:hover { color:#e2821b; }
|
||||
|
||||
/*=============================================================
|
||||
CONTROLS and CONTAINERS
|
||||
==============================================================*/
|
||||
.row-buttons .btn { margin-bottom:7px; }
|
||||
|
||||
.sidebar .box { clear:right; margin-top:2em; border-top:1px solid #d1d1d1; padding:0 1em; }
|
||||
|
||||
.pwdchange>.button { margin-bottom:10px; }
|
||||
|
||||
input[type="file"] { margin-bottom:9px; }
|
||||
|
||||
.form-inline input[type="file"] { margin-bottom:0px; }
|
||||
|
||||
input + .help-block { margin-top:-10px; margin-bottom:4px; }
|
||||
|
||||
#confirm_form input.btn, .generatedbyw2p input { margin-right:4px; }
|
||||
|
||||
a[rel='tooltip'] span, div[rel='tooltip'] span { display:none; margin-left:-9999px; }
|
||||
|
||||
/*in-page browsing*/
|
||||
[rel="pagebookmark"] { position:relative; }
|
||||
|
||||
[rel="pagebookmark"]>.component { cursor:pointer; }
|
||||
|
||||
[rel="pagebookmark"]>.hashstick { position:absolute; top:-54px; left:-9999px; visibility:visible; }
|
||||
|
||||
/* following 2 rules set the style of a small button for going to top of page*/
|
||||
.tophashlink.btn { padding:2px 3px; visibility:hidden; }
|
||||
|
||||
.hashstick:target+.tophashlink.btn { visibility:visible; }
|
||||
|
||||
ul.act_edit { margin-top:4px; margin-left:20px; }
|
||||
|
||||
ul.act_edit .btn { margin-top:4px; margin-bottom:4px; }
|
||||
|
||||
ul.act_edit .file>a { white-space:pre; }
|
||||
|
||||
.right-full { text-align:right; }
|
||||
|
||||
.searchbox, .searchbox label, .searchbox input { display:inline-block; }
|
||||
|
||||
.buttons-row .btn { margin-bottom:9px; }
|
||||
|
||||
.li-controls { display:inline-block; width:180px; vertical-align:middle; }
|
||||
|
||||
.celled { display:inline-block; padding: 0 0 0 4px; vertical-align:top; margin-top:4px; width:700px; }
|
||||
|
||||
.folder { list-style-type:none; #border-left: 1px dotted #AAA; }
|
||||
|
||||
.folder li { list-style-type:none; }
|
||||
|
||||
.folder>i { display:inline-block; width:5px; height:5px; border:1px solid; background-color:#FAA732; margin-left:-4px; margin-top:-2px; border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border-radius:1px; }
|
||||
|
||||
.folder>i+a { padding-left:0.5em; }
|
||||
|
||||
.folder ul { margin-top:0.5em; margin-bottom:0.5em; }
|
||||
|
||||
.controls-inline .btn { margin-right:5px; }
|
||||
|
||||
div.web2py_counter.span6 { min-height:24px; text-align:right; }
|
||||
|
||||
.pagination { margin:0; }
|
||||
|
||||
.table { margin-bottom:10px; }
|
||||
|
||||
.row_buttons .btn { margin-right:4px; }
|
||||
|
||||
.editor-bar-column { display:inline-block; vertical-align:top; margin-right:4px; }
|
||||
|
||||
.editor-bar-column .input-long { width:270px; }
|
||||
|
||||
.editor-bar-column .input-normal { width:206px; }
|
||||
|
||||
.keybindings li { margin-bottom:0.5em; }
|
||||
|
||||
.keybindings span { padding:0.3em; border:1px solid transparent; vertical-align:middle; }
|
||||
|
||||
.teletype-text { font-family:monospace; font-weight:bold; font-style:normal; border-color:#999; background:#333; color:#DDD; -moz-border-radius:0.3em; border-radius:0.3em; }
|
||||
|
||||
.edit_language .tab_row div { display:inline-block; vertical-align:top; margin-right:4px; }
|
||||
|
||||
.edit_language .fake-input { height:18px; padding:4px; font-size:13px; line-height:18px; overflow:hidden; white-space:nowrap; display:inline-block; margin-bottom:9px; }
|
||||
|
||||
.test h3 { padding-left:9px; margin:0; font-size:16px; line-height:1; border-left:9px solid transparent; }
|
||||
|
||||
.test h3.passed { border-color:#009900; }
|
||||
|
||||
.test h3.failed { border-color:#CC0000; }
|
||||
|
||||
.test h3.nodoctests { border-color:#CCCC99; }
|
||||
|
||||
.test .test_report { width:100%; overflow:auto; }
|
||||
|
||||
.test_report pre { white-space:pre; }
|
||||
|
||||
.test div[id^="output_"]>h2 { font-size:18px; line-height:1; color:grey; }
|
||||
|
||||
div.center { text-align:center; }
|
||||
|
||||
.delete h2 { word-wrap:break-word; }
|
||||
|
||||
/*=============================================================
|
||||
SHELL
|
||||
==============================================================*/
|
||||
.shell .output-wrapper { width:100%; height:30em; border:1px solid #333; }
|
||||
|
||||
.shell .prompt-wrapper { float:left; width:100%; overflow:hidden; height:auto; border:1px solid #333; }
|
||||
|
||||
.shell .prompt-container { margin-left:2.5em; }
|
||||
|
||||
.shell #caret { width:2.5em; float:left; margin-left:-100%; }
|
||||
|
||||
.shell #shellwrapper { background:white; color:#E8953C; width:100%; margin:1em 0; border:0; }
|
||||
|
||||
.shell #output, .shell .prompt { color:#E8953C; background:white; resize:none; border:none; width:100%; height:100%; cursor:default; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
|
||||
|
||||
.shell #output:focus, .shell .prompt:focus { border-color:transparent; outline:0; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; }
|
||||
|
||||
.shell #output pre { color: #E8953C; }
|
||||
|
||||
.shell #autoscroll { cursor:pointer; float:right; }
|
||||
|
||||
.shell .prompt, .shell #output, .shell #caret { font-size: 11pt; padding: 6px; padding-right: 0em; }
|
||||
|
||||
.shell #caret { padding-top:9px; }
|
||||
|
||||
.shell .prompt, .shell #output, .shell pre, .shell #caret { font-family: monospace; }
|
||||
|
||||
.shell a[rel="tooltip"] { margin-left:8px; }
|
||||
|
||||
/*=============================================================
|
||||
PEEK
|
||||
==============================================================*/
|
||||
.peek .code-wrapper { width:100%; overflow:auto; white-space:pre; }
|
||||
|
||||
.peek table td pre { word-break:normal; white-space:pre; }
|
||||
|
||||
/*=============================================================
|
||||
FOOTER
|
||||
==============================================================*/
|
||||
#footer { border-top:1px solid; text-align:center; padding:1em 0; }
|
||||
|
||||
#footer span, #footer select { display:inline-block; margin-bottom:0; vertical-align:middle; }
|
||||
|
||||
#footer select { width:auto; }
|
||||
|
||||
/*=============================================================
|
||||
MAIN
|
||||
==============================================================*/
|
||||
#main { margin-top:60px; /*uncomment this for alternative solution to hidden area underneath fixed navbar issue*/ margin-bottom:60px; }
|
||||
|
||||
/*=============================================================
|
||||
WIZARD
|
||||
==============================================================*/
|
||||
#wizard_nav .box { border-bottom:1px dotted; }
|
||||
|
||||
#wizard_nav li { margin-left:1em; margin-top:0.5em; }
|
||||
|
||||
.step textarea { width:auto; }
|
||||
|
||||
select[name='layout_theme'] { vertical-align:top; }
|
||||
|
||||
img#preview { margin-bottom:9px; }
|
||||
|
||||
/* multiselect customization*/
|
||||
.ms-container { margin-bottom:5px; }
|
||||
|
||||
.ms-selectable, .step .ms-selection { text-align:center; }
|
||||
|
||||
.ms-list { text-align:left; background:white; }
|
||||
|
||||
.ms-container li.ms-elem-selectable:not(.disabled).ms-hover, .ms-container .ms-selection li:not(.disabled).ms-hover { background-color:#E8953C; }
|
||||
|
||||
.ms-container .ms-selectable { margin-right:25px; }
|
||||
|
||||
.ms-container .ms-selectable, .ms-container .ms-selection { background:transparent; }
|
||||
|
||||
.ms-container .ms-list.ms-focus { border-color:rgba(232, 149, 60, 0.8); -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(232, 149, 60, 0.6); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(232, 149, 60, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(232, 149, 60, 0.6); }
|
||||
|
||||
/* grow_input*/
|
||||
ul[id$="_grow_input"] { margin-left:0; }
|
||||
|
||||
/* generate_form*/
|
||||
#generate_form .control-group { margin-bottom:0; }
|
||||
|
||||
#generate_form .control-label { text-align:left; }
|
||||
|
||||
#generate_form .controls { padding-left:18px; margin-left:0; }
|
||||
|
||||
#generate_form .control-label.empty { width:142px; }
|
||||
|
||||
.step [rel="pagebookmark"]>.hashstick { display:none; }
|
||||
|
||||
/*generated page*/
|
||||
.generated iframe { border:1px inset #e3e3e3; }
|
||||
|
||||
/*=============================================================
|
||||
ERRORS TABLE / TICKET PAGE
|
||||
==============================================================*/
|
||||
.tablebar { margin:7px 0 7px 0; }
|
||||
|
||||
.tablebar input { margin-right:27px; }
|
||||
|
||||
.tablebar span { vertical-align:bottom; }
|
||||
|
||||
.table th { background: #e9e9e9; background: -moz-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #FAFAFA), color-stop(100%, #E9E9E9)); background: -webkit-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%); background: -o-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%); background: -ms-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%); background: linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FAFAFA', endColorstr='#E9E9E9'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#FAFAFA', endColorstr='#E9E9E9')"; /*font-size:10px; color:#444; text-transform:uppercase;*/ }
|
||||
|
||||
td.cbcentered, th.cbcentered { text-align:center; }
|
||||
|
||||
td.cbcentered>input, th.cbcentered>input { margin-top:-1px; }
|
||||
|
||||
.traceback div { }
|
||||
|
||||
.ticket_code>table td:first-child { border-left:0; }
|
||||
|
||||
#trck_errors table td pre { word-break:normal; white-space:pre; }
|
||||
|
||||
.inspect pre, .errorsource pre { word-break:normal; white-space:pre; }
|
||||
|
||||
.ticket_code { background-color:lightyellow; }
|
||||
|
||||
.ticket_code table, .ticket_code td { border-width:0px; border-collapse:collapse; width:100%; }
|
||||
|
||||
.ticket_code tbody tr:hover td { background-color:transparent; }
|
||||
|
||||
/*=============================================================
|
||||
FLOT GRAPHS
|
||||
==============================================================*/
|
||||
.about #placeholder { width:auto; max-width:600px; height:300px; position:relative; margin:0 auto; /* for centering*/ }
|
||||
|
||||
/*=============================================================
|
||||
THE GRID
|
||||
==============================================================*/
|
||||
#w2p_query_panel { min-width:20px; min-height:20px; padding:10px; margin-top:1em; background-color:#f5f5f5; border: 1px solid #e3e3e3; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); }
|
||||
|
||||
#w2p_query_panel select, #w2p_query_panel input { margin-bottom:0; margin-right:4px; }
|
||||
|
||||
.web2py_grid .hidden { visibility:visible; }
|
||||
|
||||
.qry_pnl_btns { display:inline-block; }
|
||||
|
||||
#w2p_grid_addbtn, #w2p_search-form { margin-top:9px; margin-bottom:9px; }
|
||||
|
||||
#w2p_search-form { margin-bottom:0; }
|
||||
|
||||
#w2p_search-form form { margin-bottom:0; }
|
||||
|
||||
/*----- translate page ---*/
|
||||
.languageform input { margin-bottom:0; }
|
||||
|
||||
.languageform input.untranslated { background-color:#FC0; }
|
||||
|
||||
/*=============================================================
|
||||
MASKED UPLOAD INPUT (NO BOOTSTRAP RELATED)
|
||||
==============================================================*/
|
||||
#appupdate_file.masked {
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE 8 */
|
||||
filter: alpha(opacity=0); /* IE 7 */
|
||||
font-size: 100px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 410;
|
||||
}
|
||||
|
||||
#fileselect {
|
||||
padding: 4px 6px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
color: #555;
|
||||
cursor: default;
|
||||
position: relative;
|
||||
z-index: 400;
|
||||
font-size: 14px;
|
||||
background-color: #fff;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#fileselect span {
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 4px;
|
||||
}
|
||||
|
||||
.uploadbtn {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 3px;
|
||||
}
|
||||
|
||||
.txtPlaceholder {
|
||||
font-style: italic;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
/*=============================================================
|
||||
EDIT PAGE SLIDING FILES MENU
|
||||
==============================================================*/
|
||||
@media (max-width: 979px) {
|
||||
body.edit div#header {position:relative; z-index: 1030 !important;}
|
||||
}
|
||||
|
||||
#editor_area, #edit_placeholder {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#editor_area {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#files {
|
||||
width: auto;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 1031;
|
||||
border-right: 3px solid #000;
|
||||
/* animation (it doesn't work in IE<10) */
|
||||
-moz-transition: all 0.4s;
|
||||
-webkit-transition: all 0.4s;
|
||||
-o-transition: all 0.4s;
|
||||
transition: all 0.4s;
|
||||
}
|
||||
|
||||
#files:hover, #files:focus {
|
||||
left: 0px !important;
|
||||
}
|
||||
|
||||
#files, .files-toggle {
|
||||
background: #1b1b1b;
|
||||
opacity: 0.98;
|
||||
}
|
||||
|
||||
.files-toggle {
|
||||
width: 18px;
|
||||
height: 86px;
|
||||
border-radius: 0px 4px 4px 0px;
|
||||
color: #999;
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
right: -18px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
width: 18px;
|
||||
height: 70px;
|
||||
background: url(../images/files_toggle.png) no-repeat;
|
||||
}
|
||||
|
||||
.files-menu {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#filelist {
|
||||
position: relative;
|
||||
top: 60px;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
|
||||
#filelist li {
|
||||
padding-right: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#filelist li>a {
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/*=============================================================
|
||||
MEDIA QUERIES
|
||||
==============================================================*/
|
||||
@media (max-width: 800px) { .step [rel="pagebookmark"]>.hashstick { /*top:-54px;*/ display:block; }
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 767px) { [rel="pagebookmark"]>.hashstick { top:0; }
|
||||
|
||||
/*-----------------------------------
|
||||
main
|
||||
-------------------------------------*/
|
||||
#main { margin-top:0; }
|
||||
|
||||
/*-----------------------------------
|
||||
footer
|
||||
-------------------------------------*/
|
||||
#footer { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
|
||||
|
||||
/*-----------------------------------
|
||||
errors page
|
||||
-------------------------------------*/
|
||||
#trck_errors { table-layout:fixed; }
|
||||
|
||||
#trck_errors .column1 { width:20px; }
|
||||
|
||||
#trck_errors .column2 { width:45px; }
|
||||
|
||||
#trck_errors .column3 { width:150px; }
|
||||
|
||||
#trck_errors .columnN { width:55px; }
|
||||
|
||||
#trck_errors .columnN1 { width:138px; }
|
||||
|
||||
.ticket_code, .inspect.resp1, .inspect.controls pre, .errorsource { width:100%; overflow:auto; }
|
||||
|
||||
.ticket_code>table { width:100%; }
|
||||
|
||||
.celled { width:320px; }
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 480px) { .qry_pnl_btns { display:block; margin-top:4px; }
|
||||
|
||||
/*-----------------------------------
|
||||
wizard
|
||||
-------------------------------------*/
|
||||
#generate_form .control-label { float:left; width:160px; padding-top:5px; }
|
||||
|
||||
.inspect>code { display:block; white-space:normal; }
|
||||
|
||||
.li-controls { }
|
||||
|
||||
.celled { width:165px; }
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------
|
||||
miscellaneous
|
||||
-------------------------------------*/
|
||||
h4.editableapp, h4.currentapp { padding: 5px 0 5px 54px; display: inline; }
|
||||
|
||||
h4.editableapp { background: #fff url(../images/folder.png) no-repeat; }
|
||||
|
||||
h4.currentapp { background: #fff url(../images/folder_locked.png) no-repeat; }
|
||||
|
||||
.w2p_flash { position:fixed; width:50%; top:49px; left:25%; right:25%; cursor:default; text-align:center; z-index:5620; }
|
||||
span#closeflash {position:absolute; top:1px; right:-1px; font-size:150%; border:1px solid black; border-color: transparent transparent #fbeed5 #fbeed5; border-radius: 0 0 0 4px; width:22px; }
|
||||
span#closeflash:hover {font-weight:bold; cursor:pointer; }
|
||||
|
||||
table.twitter{ background-color: transparent; }
|
||||
table.twitter tr td {vertical-align: top; padding: 5px; }
|
||||
table.twitter tr { border-bottom: 1px solid #a0a0a0; }
|
||||
|
||||
div.error_wrapper {margin-top:-10px; margin-bottom:8px; padding-left:2px; color:#d62e2b; }
|
||||
|
||||
.twitter-timeline >iframe{padding: 1em 0;}
|
||||
@@ -1,7 +1,11 @@
|
||||
.calendar{z-index:99;position:relative;display:none;background:#fff;border:2px solid #000;font-size:11px;color:#000;cursor:default;font-family:Arial,Helvetica,sans-serif;
|
||||
border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
}.calendar table{margin:0px;font-size:11px;color:#000;cursor:default;font-family:tahoma,verdana,sans-serif;}.calendar .button{text-align:center;padding:1px;color:#fff;background:#000;}.calendar .nav{background:#000;color:#fff}.calendar thead .title{font-weight:bold;padding:1px;background:#000;color:#fff;text-align:center;}.calendar thead .name{padding:2px;text-align:center;background:#bbb;}.calendar thead .weekend{color:#f00;}.calendar thead .hilite {background-color:#666;}.calendar thead .active{padding:2px 0 0 2px;background-color:#c4c0b8;}.calendar tbody .day{width:2em;text-align:right;padding:2px 4px 2px 2px;}.calendar tbody .day.othermonth{color:#aaa;}.calendar tbody .day.othermonth.oweekend{color:#faa;}.calendar table .wn{padding:2px 3px 2px 2px;background:#bbb;}.calendar tbody .rowhilite td{background:#ddd;}.calendar tbody td.hilite{background:#bbb;}.calendar tbody td.active{background:#bbb;}.calendar tbody td.selected{font-weight:bold;background:#ddd;}.calendar tbody td.weekend{color:#f00;}.calendar tbody td.today{font-weight:bold;color:#00f;}.calendar tbody .disabled{color:#999;}.calendar tbody .emptycell{visibility:hidden;}.calendar tbody .emptyrow{display:none;}.calendar tfoot .ttip{background:#bbb;padding:1px;background:#000;color:#fff;text-align:center;}.calendar tfoot .hilite{background:#ddd;}.calendar tfoot .active{}.calendar .combo{position:absolute;display:none;width:4em;top:0;left:0;cursor:default;background:#e4e0d8;padding:1px;z-index:100;}.calendar .combo .label,.calendar .combo .label-IEfix{text-align:center;padding:1px;}.calendar .combo .label-IEfix{width:4em;}.calendar .combo .active{background:#c4c0b8;}.calendar .combo .hilite{background:#048;color:#fea;}.calendar td.time{padding:1px 0;text-align:center;background-color:#bbb;}.calendar td.time .hour,.calendar td.time .minute,.calendar td.time .ampm{padding:0 3px 0 4px;font-weight:bold;}.calendar td.time .ampm{text-align:center;}.calendar td.time .colon{padding:0 2px 0 3px;font-weight:bold;}.calendar td.time span.hilite{}.calendar td.time span.active{border-color:#f00;background-color:#000;color:#0f0;}.hour,.minute{font-size:2em;}
|
||||
.calendar {z-index:2000;position:relative;margin-top:140px;display:none;background-color:white;border:1px solid #000;color:#000;cursor:default;box-shadow:0 0 10px #666}.calendar * {text-align: center;font-size:10px!important}
|
||||
.calendar table {border-collapse:collapse}
|
||||
.calendar tbody tr:hover {background-color:#fbf6d9}
|
||||
.calendar td, th {padding:5px; vertical-align:top; text-align:left; border:0}
|
||||
.calendar thead tr {background-color:#f1f1f1}
|
||||
.calendar tbody tr {border-bottom:2px solid #f1f1f1}
|
||||
.calendar th {font-weight:string; padding:5px; vertical-align:bottom; text-align:left}
|
||||
.calendar thead th {vertical-align:bottom}
|
||||
.calendar tbody th {vertical-align:top}
|
||||
|
||||
#CP_hourcont{z-index:99;padding:0;position:absolute;border:1px dashed #666;background-color:#eee;display:none;}#CP_minutecont{z-index:99;background-color:#ddd;padding:1px;position:absolute;width:45px;display:none;}.floatleft{float:left;}.CP_hour{z-index:99;padding:1px;font-family:Arial,Helvetica,sans-serif;font-size:9px;white-space:nowrap;cursor:pointer;width:35px;}.CP_minute{z-index:99;padding:1px;font-family:Arial,Helvetica,sans-serif;font-size:9px;white-space:nowrap;cursor:pointer;width:auto;}.CP_over{background-color:#fff;z-index:99}
|
||||
#CP_hourcont{z-index:2000;padding:0;position:absolute;border:1px dashed #666;background-color:#eee;display:none;}#CP_minutecont{z-index:2000;background-color:#ddd;padding:1px;position:absolute;width:45px;display:none;}.floatleft{float:left;}.CP_hour{z-index:2000;padding:1px;font-family:Arial,Helvetica,sans-serif;font-size:9px;white-space:nowrap;cursor:pointer;width:35px;}.CP_minute{z-index:2000;padding:1px;font-family:Arial,Helvetica,sans-serif;font-size:9px;white-space:nowrap;cursor:pointer;width:auto;}.CP_over{background-color:#fff;z-index:2000}
|
||||
|
||||
@@ -0,0 +1,361 @@
|
||||
/************
|
||||
Created by Massimo Di Pierro
|
||||
Stupid.css is what the names says, take it with a grain of salt
|
||||
License: BSD
|
||||
************/
|
||||
|
||||
/*** basic styles ***/
|
||||
* {border:0; margin:0; padding:0; font-familiy:Helvetica}
|
||||
html, body {max-width: 100vw !important;overflow-x: hidden !important}
|
||||
body {font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif}
|
||||
p, li {margin-bottom:0.5em}
|
||||
p {text-align:justify}
|
||||
label, strong {font-weight:bold}
|
||||
ul {list-style-type:none; padding-left:20px}
|
||||
a {text-decoration:none; color:#26a69a; white-space:nowrap}
|
||||
a:hover {cursor:pointer}
|
||||
h1,h2,h3,h4,h5,h6{font-weight:strong; text-transform:uppercase}
|
||||
h1{font-size:4em; margin:1.0em 0 0.25em 0}
|
||||
h2{font-size:2.4em; margin:0.9em 0 0.25em 0}
|
||||
h3{font-size:1.8em; margin:0.8em 0 0.25em 0}
|
||||
h4{font-size:1.6em; margin:0.7em 0 0.25em 0}
|
||||
h5{font-size:1.4em; margin:0.6em 0 0.25em 0}
|
||||
h6{font-size:1.2em; margin:0.5em 0 0.25em 0}
|
||||
table {border-collapse:collapse}
|
||||
tbody tr:hover {background-color:#fbf6d9}
|
||||
td, th {padding:5px; vertical-align:top; text-align:left; border:0}
|
||||
thead tr {background-color:#f1f1f1}
|
||||
tbody tr {border-bottom:2px solid #f1f1f1}
|
||||
th {font-weight:string; padding:5px; vertical-align:bottom; text-align:left}
|
||||
thead th {vertical-align:bottom}
|
||||
tbody th {vertical-align:top}
|
||||
header, footer {with:100%}
|
||||
|
||||
@media (max-width:599px) {
|
||||
h1{font-size:2em}
|
||||
h2{font-size:1.8em}
|
||||
h3{font-size:1.6em}
|
||||
h4{font-size:1.4em}
|
||||
h5{font-size:1.2em}
|
||||
h6{font-size:1.0em}
|
||||
}
|
||||
|
||||
/*** buttons ***/
|
||||
.btn, button, [type=button], [type=submit] {padding:0.5em 1em !important; margin:0 0.5em 0.5em 0; line-height:2.4em; background-color:#26a69a; color:white}
|
||||
.btn:hover, button:hover, [type=button]:hover, [type=submit]:hover {box-shadow:0 0 10px #666; text-decoration:none; cursor:pointer}
|
||||
.btn.small, table .btn {padding:0.25em 0.5em !important; font-size:0.8em; line-height:1.5em}
|
||||
.btn.large {padding:1em 2em !important; font-size:1.2em; line-height:4em}
|
||||
.btn.oval {border-radius:50%}
|
||||
|
||||
/*** helpers ***/
|
||||
.rounded {-moz-border-radius:5px; border-radius:5px}
|
||||
.padded {padding:10px 20px !important; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box}
|
||||
.center {text-align:center !important; margin-left:auto; margin-right:auto}
|
||||
.center>div {text-align:left}
|
||||
.right {right:0; text-align:right}
|
||||
.middle div {vertical-align:middle !important}
|
||||
.bottom div {vertical-align:bottom !important}
|
||||
.xscroll {overflow-x:scroll; width:100%}
|
||||
.yscroll {overflow-y:scroll; width:100%}
|
||||
.nowrap {white-space:nowrap; overflow-x:hidden}
|
||||
.fill {width:100%}
|
||||
.lifted {box-shadow:5px 5px 10px #666}
|
||||
.relative {position:relative}
|
||||
.relative>div {position:absolute}
|
||||
.spaced {margin-bottom:20px; margin-top:20px}
|
||||
.hidden {display:none}
|
||||
|
||||
/*** forms ***/
|
||||
input:not([type]), input:not([type=checkbox]):not([type=radio]):not([type=submit]), [type=file]:before {outline:none; padding:0.5em 1em; margin:0.5px; border-bottom:1px solid #ddd; width:100%}
|
||||
textarea {width:100%; border:1px solid #ddd; padding:4px 8px; outline:none; outline:none}
|
||||
select {-webkit-appearance:none; outline:none; padding:0.5em 1em; border-radius:0; margin:0.5px; border-bottom:1px solid #ddd}
|
||||
input, textarea, select, button {font-size:12px}
|
||||
input:not([type]), input:not([type=checkbox]):not([type=radio]):not([type=submit]):hover, select:hover, textarea:hover {background-color:#fbf6d9; transition:background-color 1s ease}
|
||||
|
||||
/*** grid ***/
|
||||
.container {margin-right:-20px}
|
||||
.container>.quarter, .container>.half, .container>.third, .container>.twothirds, .container>.threequarters, .container>.fill{display:inline-block; padding:5px 20px 5px 0; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; vertical-align:top}
|
||||
.container>.fill {width:100%; margin-right:-20px}
|
||||
.container img, .container video {max-width:100%}
|
||||
@media (min-width:800px) {
|
||||
.max900 {max-width:900px; margin-left:auto; margin-right:auto}
|
||||
.quarter {width:25%; margin-right:-5px}
|
||||
.half {width:50%; margin-right:-10px}
|
||||
.third {width:33.33%; margin-right:-6.66px}
|
||||
.twothirds {width:66.66%; margin-right:-13.33px}
|
||||
.threequarters {width:75%; margin-right:-15px}
|
||||
}
|
||||
@media (min-width:600px) and (max-width:799px) {
|
||||
.quarter.compressible {width:25%; margin-right:-5px}
|
||||
.half.compressible {width:50%; margin-right:-10px}
|
||||
.threequarters.compressible {width:75%; margin-right:-15px}
|
||||
.quarter:not(.compressible), .half:not(.compressible), .threequarters:not(.compressible) {width:100%; margin-right:-20px}
|
||||
.third {width:33.33%; margin-right:-6.66px}
|
||||
.twothirds {width:66.66%; margin-right:-13.33px}
|
||||
label.quarter:not(.compressible).right, label.half:not(.compressible).right, label.threequarters:not(.compressible).right {float:left; text-align:left}
|
||||
}
|
||||
@media (max-width:599px) {
|
||||
.quarter:not(.compressible), .half:not(.compressible), .third:not(.compressible), .twothirds:not(.compressible), .threequarters:not(.compressible) {width:100%;}
|
||||
label.quarter:not(.compressible).right, label.half:not(.compressible).right, label.threequarters:not(.compressible).right,
|
||||
label.third:not(.compressible).right, label.twothirds:not(.compressible).right {float:left; text-align:left}
|
||||
.quarter.compressible {width:25%; margin-right:-5px}
|
||||
.half.compressible {width:50%; margin-right:-10px}
|
||||
.third.compressible {width:33.33%; margin-right:-6.66px}
|
||||
.twothirds.compressible {width:66.66%; margin-right:-13.33px}
|
||||
.threequarters.compressible {width:75%; margin-right:-15px}
|
||||
}
|
||||
|
||||
/*** progress bar from http://codepen.io/holdencreative/details/pvxGxy ***/
|
||||
.progress {
|
||||
margin-left:-15px;
|
||||
margin-right:-15px;
|
||||
position:relative;
|
||||
height:8px;
|
||||
display:block;
|
||||
width:120%;
|
||||
background-color:#acece6;
|
||||
border-radius:0 !important;
|
||||
background-clip:padding-box;
|
||||
overflow:hidden;
|
||||
}
|
||||
.progress .determinate {
|
||||
position:absolute;
|
||||
background-color:inherit;
|
||||
top:0;
|
||||
bottom:0;
|
||||
background-color:#26a69a;
|
||||
transition:width .3s linear;
|
||||
}
|
||||
.progress .indeterminate {
|
||||
background-color:#26a69a;
|
||||
}
|
||||
.progress .indeterminate:before {
|
||||
content:'';
|
||||
position:absolute;
|
||||
background-color:inherit;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
will-change:left, right;
|
||||
animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
||||
}
|
||||
.progress .indeterminate:after {
|
||||
content:'';
|
||||
position:absolute;
|
||||
background-color:inherit;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
will-change:left, right;
|
||||
animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
|
||||
animation-delay:1.15s;
|
||||
}
|
||||
@-webkit-keyframes indeterminate {
|
||||
0% {left:-35%; right:100%}
|
||||
60% {left:100%; right:-90%}
|
||||
100% {left:100%; right:-90%}
|
||||
}
|
||||
@-moz-keyframes indeterminate {
|
||||
0% {left:-35%; right:100%}
|
||||
60% {left:100%; right:-90%}
|
||||
100% {left:100%; right:-90%}
|
||||
}
|
||||
@keyframes indeterminate {
|
||||
0% {left:-35%; right:100%}
|
||||
60% {left:100%; right:-90%}
|
||||
100% {left:100%; right:-90%}
|
||||
}
|
||||
@-webkit-keyframes indeterminate-short {
|
||||
0% {left:-200%; right:100%}
|
||||
60% {left:107%; right:-8%}
|
||||
100% {left:107%; right:-8%}
|
||||
}
|
||||
@-moz-keyframes indeterminate-short {
|
||||
0% {left:-200%; right:100%}
|
||||
60% {left:107%; right:-8%}
|
||||
100% {left:107%; right:-8%}
|
||||
}
|
||||
@keyframes indeterminate-short {
|
||||
0% {left:-200%; right:100%}
|
||||
60% {left:107%; right:-8%}
|
||||
100% {left:107%; right:-8%}
|
||||
}
|
||||
|
||||
/**** dropdown menu from http://codepen.io/philhoyt/pen/ujHzd ***/
|
||||
.menu {list-style:none; position:relative; margin:0; padding:0}
|
||||
.menu.right {float:right}
|
||||
.menu a {padding:0 15px; text-decoration:none;text-align:left;font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; text-align:left}
|
||||
.menu li {position:relative; float:left; margin:0; padding:0}
|
||||
.menu ul {background:white; border:1px solid #e1e1e1; visibility:hidden; opacity:0; position:absolute; top:110%; padding:0; z-index:1000; transition:all 0.2s ease-out; list-style-type:none; box-shadow:5px 5px 10px #666}
|
||||
.menu ul a {padding:10px 15px; color:#333; font-weight:700; font-size:12px; line-height:16px; display: block}
|
||||
.menu ul li {float:none; width:200px}
|
||||
.menu ul ul {top:0; left:80%; z-index:2000}
|
||||
.menu li:hover > ul {visibility:visible; opacity:1}
|
||||
.menu>li>ul>li:first-child:before{content:''; position:absolute; width:1px; height:1px; border:10px solid transparent; left:50px; top:-20px; margin-left:-10px; border-bottom-color:white}
|
||||
.menu.dark ul {background:black; border:1px solid black}
|
||||
.menu.dark ul a {color:white}
|
||||
.menu.dark>li>ul>li:first-child:before{border-bottom-color:black}
|
||||
|
||||
@media (max-width:599px) {
|
||||
header .menu li, header .menu ul {width: 100%}
|
||||
header .menu.right {float:left; text-align:left}
|
||||
header .menu ul ul {top:2.5em; left:-1px; z-index:2000}
|
||||
}
|
||||
|
||||
@media (min-width:600px) {
|
||||
.ham {display:none!important}
|
||||
.burger.accordion * {max-height:1000px; overflow:visible}
|
||||
}
|
||||
|
||||
/*** pulsating ring from https://jsfiddle.net/mandynicole/7xrKP/ *******/
|
||||
.pulse:after {
|
||||
content:"";
|
||||
border:3px solid #00e6ac;
|
||||
-webkit-border-radius:30px;
|
||||
height:40px;
|
||||
width:40px;
|
||||
position:absolute;
|
||||
margin-left:-20px;
|
||||
margin-top:-20px;
|
||||
-webkit-animation:pulsate 1s ease-out;
|
||||
-webkit-animation-iteration-count:infinite;
|
||||
opacity:0.0
|
||||
}
|
||||
@-webkit-keyframes pulsate {
|
||||
0% {-webkit-transform:scale(0.1, 0.1); opacity:0.0}
|
||||
50% {opacity:1.0}
|
||||
100% {-webkit-transform:scale(1.2, 1.2); opacity:0.0}
|
||||
}
|
||||
|
||||
/**** underline effect ***/
|
||||
a:not(.btn):not(.noeffect) {position:relative}
|
||||
a:not(.btn):not(.noeffect):hover {color:#26a69a}
|
||||
a:not(.btn):not(.noeffect):hover:after {width:100%}
|
||||
a:not(.btn):not(.noeffect):after {
|
||||
display:block;
|
||||
position:absolute;
|
||||
left:0;
|
||||
bottom:-1px;
|
||||
width:0;
|
||||
height:2px;
|
||||
background-color:#26a69a;
|
||||
content:"";
|
||||
transition:width 0.2s;
|
||||
}
|
||||
|
||||
/**** modal ***/
|
||||
.modal {
|
||||
position:fixed;
|
||||
z-index:9999;
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
background-color:rgba(0,0,0,0.8);
|
||||
padding-top:20vh;
|
||||
transition:opacity 500ms;
|
||||
visibility:hidden;
|
||||
opacity:0;
|
||||
}
|
||||
.modal:target {visibility:visible; opacity:1}
|
||||
.modal div {margin-left:auto; margin-right:auto}
|
||||
.modal .close:not(.btn) {position:absolute; top:10px; right:10px; font-size:20px}
|
||||
.modal .close {transition:all 200ms}
|
||||
|
||||
/*** tooltips from http://codepen.io/trezy/pen/Khnzy ***/
|
||||
[data-tooltip] {position:relative}
|
||||
[data-tooltip]:hover:after,[data-tooltip]:hover:before {display:block}
|
||||
[data-tooltip]:before, [data-tooltip]:after {display:none; position:absolute; top:0}
|
||||
[data-tooltip]:hover:before {
|
||||
border-bottom:.6em solid black;
|
||||
border-bottom:.6em solid black;
|
||||
border-left:7px solid transparent;
|
||||
border-right:7px solid transparent;
|
||||
content:"";
|
||||
left:5px;
|
||||
margin-top:1em;
|
||||
}
|
||||
[data-tooltip]:hover:after {
|
||||
background-color:rgba(0,0,0,0.8) !important;
|
||||
border:4px solid rgba(0,0,0,0.8) !important;
|
||||
border-radius:7px !important;
|
||||
color:white !important;
|
||||
content:attr(data-tooltip);
|
||||
text-transform:none;
|
||||
font-size: 11px;
|
||||
left:0 !important;
|
||||
margin-top:1.5em;
|
||||
padding:5px 15px;
|
||||
white-space:pre-wrap;
|
||||
width:100px;
|
||||
}
|
||||
|
||||
/*** accordion ***/
|
||||
.accordion>input ~ label:before {content:"▲ "; color:#ddd}
|
||||
.accordion>input:checked ~ label:before {content:"▼ "; color:#ddd}
|
||||
.accordion>input {display:none}
|
||||
.accordion>input:checked ~ *:not(label) {
|
||||
max-height: 1000px !important;
|
||||
overflow:visible !important;
|
||||
-webkit-transition: max-height .3s ease-in;
|
||||
transition: max-height .3s ease-in;
|
||||
}
|
||||
.accordion>*:not(label) {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-transition: max-height .3s ease-out;
|
||||
transition: max-height .3s ease-out;
|
||||
}
|
||||
|
||||
|
||||
/*** cards from http://codepen.io/edeesims/pen/iGDzk ***/
|
||||
.card {perspective: 500px; max-width:100%}
|
||||
.card>div {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 15px rgba(0,0,0,0.1);
|
||||
transition: transform 1s;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
.card:hover>div {
|
||||
transform: rotateY( 180deg ) ;
|
||||
transition: transform 0.5s;
|
||||
}
|
||||
.card>div>div {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
.card>div>div:nth-child(2) {
|
||||
transform: rotateY( 180deg );
|
||||
}
|
||||
|
||||
/*** colors from http://clrs.cc/ ***/
|
||||
.navy{background-color:#001f3f!important;color:white}.blue{background-color:#0074d9!important;color:white}.aqua{background-color:#7fdbff!important;color:black}.teal{background-color:#39cccc!important;color:white}.olive{background-color:#3d9970!important;color:white}.green{background-color:#2ecc40!important;color:white}.aquamarine{background-color:#26a69a!important;color:white}.lime{background-color:#01ff70!important;color:black}.yellow{background-color:#ffdc00!important;color:black}.orange{background-color:#ff851b!important;color:white}.red{background-color:#cc1f00!important;color:white}.fuchsia{background-color:#f012be!important;color:white}.pink{background-color:#ee6e73!important;color:white}.purple{background-color:#b10dc9!important;color:white}.maroon{background-color:#85144b!important;color:white}.white{background-color:#fff!important;color:black;-webkit-box-shadow:inset 0px 0px 0px 1px #ddd;-moz-box-shadow:inset 0px 0px 0px 1px #ddd;box-shadow:inset 0px 0px 0px 1px #ddd}.gray{background-color:#aaa!important;color:white}.silver{background-color:#f1f1f1!important;color:black}.black{background-color:#000!important;color:white}.glass{background:rgba(255,255,255,0.5)!important;color:black}
|
||||
|
||||
/**** tags ****/
|
||||
.tags > span, .tags > span.off:hover {
|
||||
height: 30px;
|
||||
padding: 4px 9px;
|
||||
text-decoration: none;
|
||||
margin: 0 5px 30px 0 !important;
|
||||
white-space: nowrap;
|
||||
color: white;
|
||||
background-color: #26a69a;
|
||||
border-radius: 5px;
|
||||
line-height: 32px;
|
||||
}
|
||||
.tags.dismissible > span:not(.off):hover {
|
||||
background-color: #ccc !important;
|
||||
}
|
||||
.tags.dismissible > span:not(.off):after {
|
||||
content: " \f00d";
|
||||
font-family: FontAwesome;
|
||||
}
|
||||
.tags > span.off {
|
||||
background-color: #ccc;
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
header a {color: white; font-size:1.1em}
|
||||
main {min-height: 70vh}
|
||||
.form-group {padding-bottom: 10px !important;}
|
||||
.w2p_hidden {display:none;visibility:visible}
|
||||
.right {float:right; text-align:right}
|
||||
.left {float:left; text-align:left}
|
||||
.center {width:100%; text-align:center; vertical-align:middle}
|
||||
td.w2p_fw {padding-bottom:1px}
|
||||
td.w2p_fl,td.w2p_fw,td.w2p_fc {vertical-align:top}
|
||||
td.w2p_fl {text-align:left}
|
||||
td.w2p_fl, td.w2p_fw {padding-right:7px}
|
||||
td.w2p_fl,td.w2p_fc {padding-top:4px}
|
||||
div.w2p_export_menu {white-space: wrap; margin:5px 0}
|
||||
div.w2p_export_menu a, div.w2p_wiki_tags a, div.w2p_cloud a {margin-left:5px; padding:2px 5px; background-color:#f1f1f1; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; font-size:0.7em; color: black}
|
||||
|
||||
/* tr#submit_record__row {border-top:1px solid #E5E5E5} */
|
||||
#submit_record__row td {padding-top:.5em}
|
||||
|
||||
/* Fix */
|
||||
#auth_user_remember__row label {display:inline}
|
||||
#web2py_user_form td {vertical-align:top}
|
||||
|
||||
/*********** web2py specific ***********/
|
||||
div.w2p_flash {
|
||||
font-weight:bold;
|
||||
display:none;
|
||||
padding:20px 20px 20px 50px;
|
||||
width:100%;
|
||||
opacity:0.95;
|
||||
vertical-align:middle;
|
||||
cursor:pointer;
|
||||
color:#000;
|
||||
background-color:#ffdc00;
|
||||
z-index:2000;
|
||||
}
|
||||
|
||||
div.w2p_flash:before{content:"×";float:right; margin-right:100px; color:black;}
|
||||
.ie-lte7 div.flash #closeflash
|
||||
{color:expression(this.parentNode.currentStyle['color']);float:none;position:absolute;right:4px;}
|
||||
|
||||
div.w2p_flash:hover { opacity:0.80; }
|
||||
|
||||
div.error_wrapper {display:block}
|
||||
div.error {
|
||||
color:red;
|
||||
padding:5px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
padding:10px 0;
|
||||
width:100%;
|
||||
color:#959595;
|
||||
vertical-align:middle;
|
||||
padding:auto;
|
||||
background-image:-khtml-gradient(linear,left top,left bottom,from(#333333),to(#222222));
|
||||
background-image:-moz-linear-gradient(top,#333333,#222222);
|
||||
background-image:-ms-linear-gradient(top,#333333,#222222);
|
||||
background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#333333),color-stop(100%,#222222));
|
||||
background-image:-webkit-linear-gradient(top,#333333,#222222);
|
||||
background-image:-o-linear-gradient(top,#333333,#222222);
|
||||
background-image:linear-gradient(top,#333333,#222222);
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333',endColorstr='#222222',GradientType=0);
|
||||
-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);
|
||||
-moz-box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);
|
||||
box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.topbar a {
|
||||
color:#e1e1e1;
|
||||
}
|
||||
|
||||
#navbar {float:right; padding:5px; /* same as superfish */}
|
||||
|
||||
.statusbar {
|
||||
background-color:#F5F5F5;
|
||||
margin-top:1em;
|
||||
margin-bottom:1em;
|
||||
padding:.5em 1em;
|
||||
border:1px solid #ddd;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
}
|
||||
|
||||
.breadcrumbs {float:left}
|
||||
|
||||
.copyright {float:left}
|
||||
#poweredBy {float:right}
|
||||
|
||||
/* #MEDIA QUERIES SECTION */
|
||||
|
||||
/*
|
||||
*Grid
|
||||
*
|
||||
* The default style for SQLFORM.grid even using jquery-iu or another ui framework
|
||||
* will look better with the declarations below
|
||||
* if needed to remove base.css consider keeping these following lines in some css file.
|
||||
*/
|
||||
/* .web2py_table {border:1px solid #ccc} */
|
||||
.web2py_paginator {}
|
||||
.web2py_grid table {width:100%}
|
||||
.web2py_grid td {color: black;}
|
||||
|
||||
.web2py_console form {
|
||||
width: 100%;
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
margin: 0 0 0 5px;
|
||||
}
|
||||
|
||||
.web2py_console form select {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.web2py_search_actions {
|
||||
float:left;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.web2py_grid .row_buttons {
|
||||
min-height:25px;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.web2py_grid .row_buttons a {
|
||||
margin:3px;
|
||||
}
|
||||
|
||||
.web2py_search_actions {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.web2py_grid .row_buttons a,
|
||||
.web2py_paginator ul li a,
|
||||
.web2py_search_actions a,
|
||||
.web2py_console input[type=submit],
|
||||
.web2py_console input[type=button],
|
||||
.web2py_console button {
|
||||
line-height:20px;
|
||||
margin-right:2px; display:inline-block;
|
||||
padding:3px 5px 3px 5px;
|
||||
}
|
||||
|
||||
.web2py_counter {
|
||||
margin-top:5px;
|
||||
margin-right:2px;
|
||||
width:35%;
|
||||
float:right;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
/*Fix firefox problem*/
|
||||
.web2py_table {clear:both; display:block}
|
||||
|
||||
.web2py_paginator {
|
||||
padding:5px;
|
||||
text-align:right;
|
||||
background-color:#f2f2f2;
|
||||
|
||||
}
|
||||
.web2py_paginator ul {
|
||||
list-style-type:none;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
.web2py_paginator ul li {
|
||||
display:inline;
|
||||
}
|
||||
|
||||
.web2py_paginator .current {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.web2py_breadcrumbs ul {
|
||||
list-style:none;
|
||||
margin-bottom:18px;
|
||||
}
|
||||
|
||||
li.w2p_grid_breadcrumb_elem {
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.web2py_console form { vertical-align: middle; }
|
||||
.web2py_console input, .web2py_console select,
|
||||
.web2py_console a { margin: 2px; }
|
||||
|
||||
|
||||
#wiki_page_body {
|
||||
width: 600px;
|
||||
height: auto;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
/* fix some IE problems */
|
||||
|
||||
.ie-lte7 .topbar .container {z-index:2}
|
||||
.ie-lte8 div.w2p_flash{ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#222222', endColorstr='#000000', GradientType=0 ); }
|
||||
.ie-lte8 div.w2p_flash:hover {filter:alpha(opacity=25);}
|
||||
.ie9 #w2p_query_panel {padding-bottom:2px}
|
||||
|
||||
.web2py_console .form-control {width: 20%; display: inline;}
|
||||
.web2py_console #w2p_keywords {width: 50%;}
|
||||
.web2py_search_actions a, .web2py_console input[type=submit], .web2py_console input[type=button], .web2py_console button { padding: 6px 12px; }
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5
-5
File diff suppressed because one or more lines are too long
@@ -1,33 +0,0 @@
|
||||
// this code improves bootstrap menus and adds dropdown support
|
||||
jQuery(function(){
|
||||
jQuery('.nav>li>a').each(function(){
|
||||
if(jQuery(this).parent().find('ul').length)
|
||||
jQuery(this).attr({'class':'dropdown-toggle','data-toggle':'dropdown'}).append('<b class="caret"></b>');
|
||||
});
|
||||
jQuery('.nav li li').each(function(){
|
||||
if(jQuery(this).find('ul').length)
|
||||
jQuery(this).addClass('dropdown-submenu');
|
||||
});
|
||||
function adjust_height_of_collapsed_nav() {
|
||||
var cn = jQuery('div.collapse');
|
||||
if (cn.get(0)) {
|
||||
var cnh = cn.get(0).style.height;
|
||||
if (cnh>'0px'){
|
||||
cn.css('height','auto');
|
||||
}
|
||||
}
|
||||
}
|
||||
function hoverMenu(){
|
||||
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
|
||||
adjust_height_of_collapsed_nav();
|
||||
var mi = jQuery(this).addClass('open');
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
|
||||
}, function(){
|
||||
var mi = jQuery(this);
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
|
||||
});
|
||||
}
|
||||
hoverMenu(); // first page load
|
||||
jQuery(window).resize(hoverMenu); // on resize event
|
||||
jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');});
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
{{extend 'layout.html'}}
|
||||
{{block sectionclass}}about{{end}}
|
||||
<!-- begin "about" block -->
|
||||
<h2>{{=T("About application")}} "{{=app}}"</h2>
|
||||
<h3>{{=T("About")}} {{=app}}</h3>
|
||||
@@ -23,4 +22,4 @@ jQuery(document).ready(function() {
|
||||
jQuery.plot(jQuery("#placeholder"), [ {{=progress}} ]);
|
||||
})
|
||||
</script>
|
||||
<!-- end "about" block -->
|
||||
<!-- end "about" block -->
|
||||
|
||||
@@ -9,19 +9,16 @@ def peekfile(path,file,vars={},title=None):
|
||||
return A(file.replace('\\\\','/'),_title=title,_href=URL('peek', args=args, vars=vars))
|
||||
def editfile(path,file,vars={}):
|
||||
args=(path,file) if 'app' in vars else (app,path,file)
|
||||
return A(SPAN(T('Edit')),_class='button editbutton btn btn-mini',_href=URL('edit', args=args, vars=vars))
|
||||
return A(T('Edit'),_class='btn small rounded black',_href=URL('edit', args=args, vars=vars))
|
||||
def testfile(path,file):
|
||||
return A(TAG[''](IMG(_src=URL('static', 'images/test_icon.png'), _alt=T('test')),
|
||||
SPAN(T("Run tests in this file (to run all files, you may also use the button labelled 'test')"))),
|
||||
_class='icon test',
|
||||
_href=URL('test', args=(app, file)),
|
||||
_rel="tooltip",
|
||||
**{'_data-placement':'right',
|
||||
'_data-original-title':T("Run tests in this file (to run all files, you may also use the button labelled 'test')")})
|
||||
return A(I(_class="fa fa-cog"),**{
|
||||
'_class':'btn small rounded black',
|
||||
'_data-tooltip':T("Run tests in this file (to run all files, you may also use the but\
|
||||
ton labelled 'test')")})
|
||||
def editlanguagefile(path,file,vars={}):
|
||||
return A(SPAN(T('Edit')),_class='button editbutton btn btn-mini',_href=URL('edit_language', args=(app, path, file), vars=vars))
|
||||
return A(T('Edit'),_class='button editbutton btn rounded small',_href=URL('edit_language', args=(app, path, file), vars=vars))
|
||||
def editpluralsfile(path,file,vars={}):
|
||||
return A(SPAN(T('Edit')),_class='button editbutton btn btn-mini',_href=URL('edit_plurals', args=(app, path, file), vars=vars))
|
||||
return A(T('Edit'),_class='button editbutton btn rounded small',_href=URL('edit_plurals', args=(app, path, file), vars=vars))
|
||||
def file_upload_form(location, anchor=None):
|
||||
form=FORM(
|
||||
LABEL(T("upload file:")),
|
||||
@@ -59,13 +56,8 @@ def upload_plugin_form(app, anchor=None):
|
||||
return form
|
||||
def deletefile(arglist, vars={}):
|
||||
vars.update({'sender':request.function+'/'+app})
|
||||
return A(TAG[''](IMG(_src=URL('static', 'images/delete_icon.png')),
|
||||
SPAN(T('Delete this file (you will be asked to confirm deletion)'))),
|
||||
_href=URL('delete',args=arglist,vars=vars),
|
||||
_class='icon delete',
|
||||
_rel="tooltip",
|
||||
**{'_data-placement':'right',
|
||||
'_data-original-title':T('Delete this file (you will be asked to confirm deletion)')})
|
||||
return A(I(_class='fa fa-trash'),_class="red rounded small btn",
|
||||
_href=URL('delete',args=arglist,vars=vars))
|
||||
}}
|
||||
|
||||
{{block sectionclass}}design{{end}}
|
||||
@@ -74,64 +66,66 @@ def deletefile(arglist, vars={}):
|
||||
<h2>{{=T("Edit application")}} "{{=A(app,_href=URL(app,'default','index'),_target="_blank")}}"</h2>
|
||||
|
||||
<!-- COLLAPSE/JUMP-TO BUTTONS -->
|
||||
<div class="right-full controls">
|
||||
<p class="buttons-row">
|
||||
{{=searchbox('search')}}
|
||||
<a class="button special btn btn-inverse" href="#" onclick="jQuery('h3>span').click();return false"><span>{{=T("collapse/expand all")}}</span></a>
|
||||
<span class="buttongroup">
|
||||
{{=button('#models', T("models"))}}
|
||||
{{=button('#controllers', T("controllers"))}}
|
||||
{{=button('#views', T("views"))}}
|
||||
{{=button('#languages', T("languages"))}}
|
||||
{{=button('#static', T("static"))}}
|
||||
{{=button('#modules', T("modules"))}}
|
||||
{{=button('#private', T("private files"))}}
|
||||
{{=button('#plugins', T("plugins"))}}
|
||||
</span>
|
||||
</p>
|
||||
<div class="container">
|
||||
<div class="fill">
|
||||
<input placeholder="filter" id="search" style="left:100px"/>
|
||||
</div>
|
||||
<div class="fill">
|
||||
<div class="padded">
|
||||
<a class="btn rounded small black" href="#" onclick="jQuery('.accordion>[type=checkbox]').click();return false">{{=T("collapse/expand all")}}</a>
|
||||
<a href="#models" class="btn small rounded orange">{{=T("models")}}</a>
|
||||
<a href="#controllers" class="btn small rounded orange">{{=T("controllers")}}</a>
|
||||
<a href="#views" class="btn small rounded orange">{{=T("views")}}</a>
|
||||
<a href="#models" class="btn small rounded orange">{{=T("languages")}}</a>
|
||||
<a href="#static" class="btn small rounded orange">{{=T("static")}}</a>
|
||||
<a href="#models" class="btn small rounded orange">{{=T("modules")}}</a>
|
||||
<a href="#private" class="btn small rounded orange">{{=T("private files")}}</a>
|
||||
<a href="#plugins" class="btn small rounded orange">{{=T("plugins")}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODELS -->
|
||||
<h3 id="_models" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('models_inner');">{{=T("Models")}}</span>
|
||||
<a href="#models" rel="tooltip" data-placement="right" data-original-title="{{=T('The data representation, define database tables and sets')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("The data representation, define database tables and sets")}}</span>
|
||||
</a><span id="models" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="models_inner" class="component_contents">
|
||||
<h5 id="_models">
|
||||
<label class="component" for="models_inner" data-tooltip="{{=T('The data representation, define database tables and sets')}}">{{=T("Models")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="models_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not models:}}<p><strong>{{=T("There are no models")}}</strong></p>{{else:}}
|
||||
<div class="controls comptools">
|
||||
{{=button(URL(a=app,c='appadmin',f='index'), T('database administration'))}}
|
||||
{{if os.access(os.path.join(request.folder,'..',app,'databases','sql.log'),os.R_OK):}}
|
||||
{{=button(URL('peek/%s/databases/sql.log'%app), 'sql.log')}}
|
||||
{{pass}}
|
||||
{{=button(URL(a=app, c='appadmin',f='graph_model'), T('graph model'))}}
|
||||
{{=button(URL(a=app,c='appadmin',f='index'), T('database administration'))}}
|
||||
{{if os.access(os.path.join(request.folder,'..',app,'databases','sql.log'),os.R_OK):}}
|
||||
{{=button(URL('peek/%s/databases/sql.log'%app), 'sql.log')}}
|
||||
{{pass}}
|
||||
{{=button(URL(a=app, c='appadmin',f='graph_model'), T('graph model'))}}
|
||||
</div>
|
||||
<ul class="unstyled act_edit">
|
||||
{{for m in models:}}
|
||||
{{id="models__"+m.replace('.','__')}}
|
||||
<li id="{{='_'+id}}" rel="pagebookmark"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('models',m, dict(id=id))}}
|
||||
{{=deletefile([app, 'models', m], dict(id=id, id2='models'))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('models',m, dict(id=id))}}
|
||||
</span>
|
||||
<span class="extras">
|
||||
{{if len(defines[m]):}}{{=T("defines tables")}} {{pass}}{{=XML(', '.join([B(table).xml() for table in defines[m]]))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
{{for m in models:}}
|
||||
{{id="models__"+m.replace('.','__')}}
|
||||
<li id="{{='_'+id}}"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('models',m, dict(id=id))}}
|
||||
{{=deletefile([app, 'models', m], dict(id=id, id2='models'))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('models',m, dict(id=id))}}
|
||||
</span>
|
||||
<span class="extras">
|
||||
{{if len(defines[m]):}}{{=T("defines tables")}} {{pass}}{{=XML(', '.join([B(table).xml() for table in defines[m]]))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form1').slideToggle()" class="btn btn-mini">{{=T('Create')}}</button>
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form1').slideToggle()" class="btn rounded small">{{=T('Create')}}</button>
|
||||
<div id="form1" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/models/' % app, 'models')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- FIND CONTROLLER FUNCTIONS -->
|
||||
@@ -141,163 +135,162 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi
|
||||
}}
|
||||
|
||||
<!-- CONTROLLERS -->
|
||||
<h3 id="_controllers" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('controllers_inner');">{{=T("Controllers")}}</span>
|
||||
<a href="#controllers" rel="tooltip" data-placement="right" data-original-title="{{=T('The application logic, each URL path is mapped in one exposed function in the controller')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("The application logic, each URL path is mapped in one exposed function in the controller")}}</span>
|
||||
</a><span id="controllers" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="controllers_inner" class="component_contents">
|
||||
<h5 id="_controllers">
|
||||
<label class="component" for="controllers_inner" data-tooltip="{{=T('The application logic, each URL path is mapped in one exposed function in the controller')}}">{{=T("Controllers")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="controllers_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not controllers:}}<p><strong>{{=T("There are no controllers")}}</strong></p>{{else:}}
|
||||
<div class="controls comptools">
|
||||
{{=button(URL(r=request,c='shell',f='index',args=app), T("shell"))}}
|
||||
{{=button(URL('test',args=app), T("test"))}}
|
||||
{{=button(URL('edit',args=[app,'cron','crontab']), T("crontab"))}}
|
||||
{{=button(URL(r=request,c='shell',f='index',args=app), T("shell"))}}
|
||||
{{=button(URL('test',args=app), T("test"))}}
|
||||
{{=button(URL('edit',args=[app,'cron','crontab']), T("crontab"))}}
|
||||
</div>
|
||||
<ul class="unstyled act_edit">
|
||||
{{for c in controllers:}}
|
||||
{{id="controllers__"+c.replace('.','__')}}
|
||||
<li id="{{='_'+id}}" rel="pagebookmark"><span id="{{=id}}" class="hashstick"> </span>
|
||||
{{for c in controllers:}}
|
||||
{{id="controllers__"+c.replace('.','__')}}
|
||||
<li id="{{='_'+id}}"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('controllers',c, dict(id=id))}}
|
||||
{{=deletefile([app, 'controllers', c], dict(id=id, id2='controllers'))}}
|
||||
{{=testfile('controllers',c)}}
|
||||
{{=editfile('controllers',c, dict(id=id))}}
|
||||
{{=deletefile([app, 'controllers', c], dict(id=id, id2='controllers'))}}
|
||||
{{=testfile('controllers',c)}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('controllers',c, dict(id=id))}}
|
||||
{{=peekfile('controllers',c, dict(id=id))}}
|
||||
</span>
|
||||
<span class="extras celled">
|
||||
{{if functions[c]:}}{{=T("exposes")}}{{pass}} {{=XML(', '.join([A(f,_href=URL(a=app,c=c[:-3],f=f)).xml() for f in functions[c]]))}}
|
||||
{{if functions[c]:}}{{=T("exposes")}}{{pass}} {{=XML(', '.join([A(f,_href=URL(a=app,c=c[:-3],f=f)).xml() for f in functions[c]]))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form2').slideToggle()" class="btn btn-mini">{{=T('Create')}}</button>
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form2').slideToggle()" class="btn rounded small">{{=T('Create')}}</button>
|
||||
<div id="form2" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/controllers/' % app, 'controllers')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VIEWS -->
|
||||
<h3 id="_views" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('views_inner');">{{=T("Views")}}</span>
|
||||
<a href="#views" rel="tooltip" data-placement="right" data-original-title="{{=T('The presentations layer, views are also known as templates')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("The presentations layer, views are also known as templates")}}</span>
|
||||
</a><span id="views" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="views_inner" class="component_contents">
|
||||
{{if not views:}}<p><strong>{{=T("There are no views")}}</strong></p>{{else:}}
|
||||
<h5 id="_views">
|
||||
<label class="component" for="views_inner" data-tooltip="{{=T('The presentations layer, views are also known as templates')}}">{{=T("Views")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="views_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not views:}}<p><strong>{{=T("There are no views")}}</strong></p>{{else:}}
|
||||
<div class="controls comptools">
|
||||
{{=button(LAYOUTS_APP, T("Download layouts from repository"))}}
|
||||
{{=button(LAYOUTS_APP, T("Download layouts from repository"))}}
|
||||
</div>
|
||||
<ul class="unstyled act_edit">
|
||||
{{for c in views:}}
|
||||
{{id="views__"+c.replace('/','__').replace('.','__')}}
|
||||
<li id="{{='_'+id}}" rel="pagebookmark"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('views',c, dict(id=id))}}
|
||||
{{=deletefile([app, 'views', c], dict(id=id, id2='views'))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('views',c, dict(id=id))}}
|
||||
</span>
|
||||
<span class="extras celled celled-one">
|
||||
{{if c in extend:}}{{=T("extends")}} <b>{{=extend[c]}}</b> {{pass}}
|
||||
{{if include[c]:}}{{=T("includes")}} {{pass}}{{=XML(', '.join([B(f).xml() for f in include[c]]))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
{{for c in views:}}
|
||||
{{id="views__"+c.replace('/','__').replace('.','__')}}
|
||||
<li id="{{='_'+id}}"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('views',c, dict(id=id))}}
|
||||
{{=deletefile([app, 'views', c], dict(id=id, id2='views'))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('views',c, dict(id=id))}}
|
||||
</span>
|
||||
<span class="extras celled celled-one">
|
||||
{{if c in extend:}}{{=T("extends")}} <b>{{=extend[c]}}</b> {{pass}}
|
||||
{{if include[c]:}}{{=T("includes")}} {{pass}}{{=XML(', '.join([B(f).xml() for f in include[c]]))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form3').slideToggle()" class="btn btn-mini">{{=T('Create')}}</button>
|
||||
{{pass}}
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form3').slideToggle()" class="btn rounded small">{{=T('Create')}}</button>
|
||||
<div id="form3" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/views/' % app, 'views')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- LANGUAGES -->
|
||||
<h3 id="_languages" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('languages_inner');">{{=T("Languages")}}</span>
|
||||
<a href="#languages" rel="tooltip" data-placement="right" data-original-title="{{=T('Translation strings for the application')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("Translation strings for the application")}}</span>
|
||||
</a><span id="languages" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="languages_inner" class="component_contents">
|
||||
<h5 id="_languages">
|
||||
<label class="component" for="languages_inner" data-tooltip="{{=T('Translation strings for the application')}}">{{=T("Languages")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="languages_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not languages:}}<p><strong>{{=T("There are no translators, only default language is supported")}}</strong></p>{{else:}}
|
||||
<div class="controls comptools">
|
||||
{{=button(URL('update_languages/'+app), T('update all languages'))}}
|
||||
{{=button(URL('update_languages/'+app), T('update all languages'))}}
|
||||
</div>
|
||||
<ul class="unstyled act_edit">
|
||||
{{for lang in sorted(languages):
|
||||
file = lang+'.py'
|
||||
id = "languages__"+file.replace('.','__')}}
|
||||
<li id="{{='_'+id}}" rel="pagebookmark" class="li-row"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="li-controls">
|
||||
<span class="filetools controls">
|
||||
{{=editlanguagefile('languages',file)}}
|
||||
{{=deletefile([app, 'languages', file], dict(id=id, id2='languages'))}}
|
||||
</span>
|
||||
<span class="">
|
||||
{{=peekfile('languages',file, dict(id=id))}}
|
||||
</span>
|
||||
</span> <!-- /li-row -->
|
||||
<span class="extras celled">
|
||||
(
|
||||
{{=T("Plural-Forms:")}}
|
||||
{{p=languages[lang][3:7]}}
|
||||
{{if p[2] == 'default':}}
|
||||
<span class='error text-error'>{{=T("rules are not defined")}}</span> {{=T.M("(file **gluon/contrib/plural_rules/%s.py** is not found)",lang[:2])}}
|
||||
{{else:}}
|
||||
{{if p[3] == 1:}}
|
||||
{{=B(T("are not used"))}}
|
||||
{{else:}}
|
||||
{{pfile=p[0]}}
|
||||
{{if p[1]!=0:}}<span style="display:inline-block;margin-top:-10px;">
|
||||
<span class="filetools controls">
|
||||
{{=editpluralsfile('languages',pfile,dict(nplurals=p[3]))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('languages',pfile,dict(id=id))}}
|
||||
</span></span>
|
||||
{{else:}}
|
||||
<b>{{=T("are not used yet")}}</b>
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
)
|
||||
</span>
|
||||
</li>
|
||||
{{for lang in sorted(languages):
|
||||
file = lang+'.py'
|
||||
id = "languages__"+file.replace('.','__')}}
|
||||
<li id="{{='_'+id}}" class="li-row"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="li-controls">
|
||||
<span class="filetools controls">
|
||||
{{=editlanguagefile('languages',file)}}
|
||||
{{=deletefile([app, 'languages', file], dict(id=id, id2='languages'))}}
|
||||
</span>
|
||||
<span class="">
|
||||
{{=peekfile('languages',file, dict(id=id))}}
|
||||
</span>
|
||||
</span> <!-- /li-row -->
|
||||
<span class="extras celled">
|
||||
(
|
||||
{{=T("Plural-Forms:")}}
|
||||
{{p=languages[lang][3:7]}}
|
||||
{{if p[2] == 'default':}}
|
||||
<span class='error text-error'>{{=T("rules are not defined")}}</span> {{=T.M("(file **gluon/contrib/plural_rules/%s.py** is not found)",lang[:2])}}
|
||||
{{else:}}
|
||||
{{if p[3] == 1:}}
|
||||
{{=B(T("are not used"))}}
|
||||
{{else:}}
|
||||
{{pfile=p[0]}}
|
||||
{{if p[1]!=0:}}<span style="display:inline-block;margin-top:-10px;">
|
||||
<span class="filetools controls">
|
||||
{{=editpluralsfile('languages',pfile,dict(nplurals=p[3]))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('languages',pfile,dict(id=id))}}
|
||||
</span></span>
|
||||
{{else:}}
|
||||
<b>{{=T("are not used yet")}}</b>
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
)
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form4').slideToggle()" class="btn btn-mini">{{=T('Create')}}</button>
|
||||
{{pass}}
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form4').slideToggle()" class="btn rounded small">{{=T('Create')}}</button>
|
||||
<div id="form4" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/languages/' % app, 'languages', T('(something like "it-it")'))}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- STATIC -->
|
||||
<h3 id="_static" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('static_inner');">{{=T("Static")}}</span>
|
||||
<a href="#static" rel="tooltip" data-placement="right" data-original-title="{{=T('These files are served without processing, your images go here')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("These files are served without processing, your images go here")}}</span>
|
||||
</a><span id="static" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="static_inner" class="component_contents">
|
||||
<h5 id="_static">
|
||||
<label class="component" for="static_inner" data-tooltip="{{=T('These files are served without processing, your images go here')}}">{{=T("Static")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="static_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not statics:}}<p><strong>{{=T("There are no static files")}}</strong></p>{{else:}}
|
||||
<ul class="unstyled act_edit">
|
||||
{{
|
||||
{{
|
||||
path=[]
|
||||
for file in statics+['']:
|
||||
items=file.split('/')
|
||||
@@ -308,88 +301,89 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi
|
||||
path.append(file_path[len(path)])
|
||||
thispath = regex_space.sub('-', 'static__'+'__'.join(path))
|
||||
}}
|
||||
<li class="folder"><i> </i>
|
||||
<a href="javascript:collapse('{{=thispath}}');" class="file">{{=path[-1]}}/</a>
|
||||
<ul id="{{=thispath}}" style="display: none;" class="sublist">{{
|
||||
else:
|
||||
path = path[:-1]
|
||||
}}
|
||||
</ul></li>
|
||||
<li class="folder"><i> </i>
|
||||
<a href="javascript:collapse('{{=thispath}}');" class="file">{{=path[-1]}}/</a>
|
||||
<ul id="{{=thispath}}" style="display: none;" class="sublist">{{
|
||||
else:
|
||||
path = path[:-1]
|
||||
}}
|
||||
</ul>
|
||||
</li>
|
||||
{{
|
||||
pass
|
||||
pass
|
||||
if filename:
|
||||
}}
|
||||
<li>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('static',file, dict(id="static"))}} {{=deletefile([app,'static',file], dict(id="static",id2="static"))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
<a href="{{=URL(a=app,c='static',f=file)}}">{{=filename}}</a>
|
||||
</span>
|
||||
</li>{{
|
||||
pass
|
||||
pass
|
||||
}}
|
||||
<li>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('static',file, dict(id="static"))}} {{=deletefile([app,'static',file], dict(id="static",id2="static"))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
<a href="{{=URL(a=app,c='static',f=file)}}">{{=filename}}</a>
|
||||
</span>
|
||||
</li>{{
|
||||
pass
|
||||
pass
|
||||
}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form5').slideToggle()" class="btn btn-mini">{{=T('Create/Upload')}}</button>
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form5').slideToggle()" class="btn rounded small">{{=T('Create/Upload')}}</button>
|
||||
<div id="form5" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/static/' % app, 'static')}}<em>{{=T('or alternatively')}}</em></div>
|
||||
<div class="span3">{{=file_upload_form('%s/static/' % app, 'static')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODULES -->
|
||||
<h3 id="_modules" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('modules_inner');">{{=T("Modules")}}</span>
|
||||
<a href="#modules" rel="tooltip" data-placement="right" data-original-title="{{=T('Additional code for your application')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("Additional code for your application")}}</span>
|
||||
</a><span id="modules" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="modules_inner" class="component_contents">
|
||||
<h5 id="_modules">
|
||||
<label class="component" for="modules_inner" data-tooltip="{{=T('Additional code for your application')}}">{{=T("Modules")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="modules_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not modules:}}<p><strong>{{=T("There are no modules")}}</strong></p>{{else:}}
|
||||
<ul class="unstyled act_edit">
|
||||
{{for m in modules:}}
|
||||
{{id="modules__"+m.replace('/','__').replace('.','__')}}
|
||||
<li id="{{='_'+id}}" rel="pagebookmark"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span class="filetols controls">
|
||||
{{=editfile('modules',m,dict(id=id))}}
|
||||
{{if m!='__init__.py':}}
|
||||
{{=deletefile([app, 'modules', m], dict(id=id, id2='modules'))}}
|
||||
{{pass}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('modules',m, dict(id=id))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
{{for m in modules:}}
|
||||
{{id="modules__"+m.replace('/','__').replace('.','__')}}
|
||||
<li id="{{='_'+id}}"><span id="{{=id}}" class="hashstick"> </span>
|
||||
<span>
|
||||
{{=editfile('modules',m,dict(id=id))}}
|
||||
{{if m!='__init__.py':}}
|
||||
{{=deletefile([app, 'modules', m], dict(id=id, id2='modules'))}}
|
||||
{{pass}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('modules',m, dict(id=id))}}
|
||||
</span>
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form6').slideToggle()" class="btn btn-mini">{{=T('Create/Upload')}}</button>
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form6').slideToggle()" class="btn rounded small">{{=T('Create/Upload')}}</button>
|
||||
<div id="form6" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/modules/' % app, 'modules')}}<em>{{=T('or alternatively')}}</em></div>
|
||||
<div class="span3">{{=file_upload_form('%s/modules/' % app, 'modules')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PRIVATE -->
|
||||
<h3 id="_private" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('private_inner');">{{=T("Private files")}}</span>
|
||||
<a href="#private" rel="tooltip" data-placement="right" data-original-title="{{=T('These files are not served, they are only available from within your app')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("These files are not served, they are only available from within your app")}}</span>
|
||||
</a><span id="private" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="private_inner" class="component_contents">
|
||||
<h5 id="_private">
|
||||
<label class="component" for="private_inner" data-tooltip="{{=T('These files are not served, they are only available from within your app')}}">{{=T("Private files")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="private_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if not privates:}}<p><strong>{{=T("There are no private files")}}</strong></p>{{else:}}
|
||||
<ul class="unstyled act_edit">
|
||||
{{
|
||||
{{
|
||||
path=[]
|
||||
for file in privates+['']:
|
||||
items=file.split('/')
|
||||
@@ -400,72 +394,74 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi
|
||||
path.append(file_path[len(path)])
|
||||
thispath='private__'+'__'.join(path)
|
||||
}}
|
||||
<li class="folder">
|
||||
<a href="javascript:collapse('{{=thispath}}');" class="file">{{=path[-1]}}/</a>
|
||||
<ul id="{{=thispath}}" style="display: none;" class="sublist">{{
|
||||
else:
|
||||
path = path[:-1]
|
||||
}}
|
||||
</ul>
|
||||
</li>
|
||||
{{
|
||||
<li class="folder">
|
||||
<a href="javascript:collapse('{{=thispath}}');" class="file">{{=path[-1]}}/</a>
|
||||
<ul id="{{=thispath}}" style="display: none;" class="sublist">{{
|
||||
else:
|
||||
path = path[:-1]
|
||||
}}
|
||||
</ul>
|
||||
</li>
|
||||
{{
|
||||
pass
|
||||
pass
|
||||
if filename:
|
||||
}}
|
||||
<li>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('private',file, dict(id="private"))}} {{=deletefile([app,'private',file], dict(id="private",id2="private"))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('private',file, dict(id="private"))}}
|
||||
</span>
|
||||
</li>{{
|
||||
pass
|
||||
pass
|
||||
}}
|
||||
}}
|
||||
<li>
|
||||
<span class="filetools controls">
|
||||
{{=editfile('private',file, dict(id="private"))}} {{=deletefile([app,'private',file], dict(id="private",id2="private"))}}
|
||||
</span>
|
||||
<span class="file">
|
||||
{{=peekfile('private',file, dict(id="private"))}}
|
||||
</span>
|
||||
</li>{{
|
||||
pass
|
||||
pass
|
||||
}}
|
||||
{{pass}}
|
||||
</ul>
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form7').slideToggle()" class="btn btn-mini">{{=T('Create/Upload')}}</button>
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form7').slideToggle()" class="btn rounded small">{{=T('Create/Upload')}}</button>
|
||||
<div id="form7" class="row-fluid" style="display:none">
|
||||
<div class="span3">{{=file_create_form('%s/private/' % app, 'private')}}<em>{{=T('or alternatively')}}</em></div>
|
||||
<div class="span3">{{=file_upload_form('%s/private/' % app, 'private')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PLUGINS -->
|
||||
<h3 id="_plugins" rel="pagebookmark">
|
||||
<span class="component" onclick="collapse('plugins_inner');">{{=T("Plugins")}}</span>
|
||||
<a href="#plugins" rel="tooltip" data-placement="right" data-original-title="{{=T('To create a plugin, name a file/folder plugin_[name]')}}">
|
||||
{{=helpicon()}}
|
||||
<span>{{=T("To create a plugin, name a file/folder plugin_[name]")}}</span>
|
||||
</a><span id="plugins" class="hashstick"> </span><a href="#" class="tophashlink btn btn-mini btn-warning"><span>top</span></a>
|
||||
</h3>
|
||||
<div id="plugins_inner" class="component_contents">
|
||||
<h5 id="_plugins">
|
||||
<label class="component" for="plugins_inner" data-tooltip="{{=T('To create a plugin, name a file/folder plugin_[name]')}}">{{=T("Plugins files")}}</label>
|
||||
</h5>
|
||||
<div class="accordion">
|
||||
<input type="checkbox" id="plugins_inner" checked>
|
||||
<div>
|
||||
<a href="#" class="right btn rounded small yellow">top</a>
|
||||
{{if plugins:}}
|
||||
<ul class="unstyled act_edit">
|
||||
{{for plugin in plugins:}}
|
||||
{{id="plugins__"+plugin.replace('/','__').replace('.','__')}}
|
||||
<li id="{{=id}}">
|
||||
{{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin', args=[app, plugin], vars=dict(id=id, id2='plugins')))}}
|
||||
</li>
|
||||
{{pass}}
|
||||
{{for plugin in plugins:}}
|
||||
{{id="plugins__"+plugin.replace('/','__').replace('.','__')}}
|
||||
<li id="{{=id}}">
|
||||
{{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin', args=[app, plugin], vars=dict(id=id, id2='plugins')))}}
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{else:}}
|
||||
<p><strong>{{=T('There are no plugins')}}</strong></p>
|
||||
{{pass}}
|
||||
<div class="controls comptools">
|
||||
{{=button(URL(c="default", f="plugins", args=[app,]), T('Download plugins from repository'))}}
|
||||
{{=button(URL(c="default", f="plugins", args=[app,]), T('Download plugins from repository'))}}
|
||||
</div>
|
||||
<div class="controls formfield">
|
||||
<button onclick="jQuery('#form8').slideToggle()" class="btn btn-mini">{{=T('Upload')}}</button>
|
||||
<div class="silver rounded padded">
|
||||
<button onclick="jQuery('#form8').slideToggle()" class="btn rounded small">{{=T('Upload')}}</button>
|
||||
<div id="form8" class="row-fluid" style="display:none">
|
||||
<div class="row-fluid">
|
||||
<div class="span3">{{=upload_plugin_form(app, 'plugins')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -490,6 +486,7 @@ jQuery(document).ready(function(){
|
||||
if(code==13) filter_files();
|
||||
});
|
||||
jQuery('#search_start').click(function(e){ filter_files(); });
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
<!-- end "design" block -->
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ def file_create_form(location, anchor=None, helptext=""):
|
||||
<!-- begin "edit" block -->
|
||||
{{
|
||||
def shortcut(combo, description):
|
||||
return XML('<li class="span5"><span class="teletype-text">%s</span><span>%s</span></li>' % (combo, description))
|
||||
return XML('<li><span class="teletype-text">%s</span><span>%s</span></li>' % (combo, description))
|
||||
def listfiles(app, dir, regexp='.*\.py$'):
|
||||
files = sorted(
|
||||
listdir(apath('%(app)s/%(dir)s/' % {'app':app, 'dir':dir}, r=request), regexp))
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
{{extend 'layout.html'}}
|
||||
{{block sectionclass}}login{{end}}
|
||||
<!-- begin "index" block -->
|
||||
<h2>web2py™ {{=T('Web Framework')}}</h2>
|
||||
<h3>{{=T('Login to the Administrative Interface')}}</h3>
|
||||
<div class="form row-fluid">
|
||||
<div class="twothirds padded lifted">
|
||||
{{if request.is_https or request.is_local:}}
|
||||
<form action="{{=URL(r=request)}}" method="post" class="span4 well">
|
||||
<label for="password">{{=T('Administrator Password:')}}</label>
|
||||
<input type="password" name="password" id="password"/>
|
||||
<input type="hidden" name="send" value="{{=send}}"/>
|
||||
<div class="controls"><button type="submit" name="login" class="btn">{{=T('Login')}}</button></div>
|
||||
</form>
|
||||
<form action="{{=URL(r=request)}}" method="post" class="span4 well">
|
||||
<h5>{{=T('Login to the Administrative Interface')}}</h5>
|
||||
<label class="spaced" for="password">{{=T('Administrator Password:')}}</label>
|
||||
<input class="spaced" type="password" name="password" id="password"/>
|
||||
<input class="spaced" type="hidden" name="send" value="{{=send}}"/>
|
||||
<button class="spaced" type="submit" name="login">{{=T('Login')}}</button>
|
||||
</form>
|
||||
{{else:}}
|
||||
<p class="help span7 alert alert-block alert-warning">{{=T('ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.')}}</p>
|
||||
{{pass}}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
jQuery("#password").focus();
|
||||
});
|
||||
jQuery(document).ready(function(){
|
||||
jQuery("#password").focus();
|
||||
});
|
||||
</script>
|
||||
<!-- end "index" block -->
|
||||
<!-- end "index" block -->
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{{extend 'layout.html'}}
|
||||
{{import os, glob}}
|
||||
{{block sectionclass}}site{{end}}
|
||||
<!-- begin "site" block -->
|
||||
<div class="row-fluid">
|
||||
<div class="applist f60 span7">
|
||||
<div class="applist_inner">
|
||||
<div class="container">
|
||||
<div class="twothirds">
|
||||
<div class="padded">
|
||||
<h2>{{=T("Installed applications")}}</h2>
|
||||
<table width="100%" class="table">
|
||||
{{for a in apps:}}
|
||||
<tr>{{buttons = []}}
|
||||
<td>
|
||||
<table>
|
||||
<tbody>
|
||||
{{for a in apps:}}
|
||||
<tr>{{buttons = []}}
|
||||
<td>
|
||||
{{if a==request.application:}}
|
||||
<h4 class="currentapp">{{=a}} ({{=T('currently running')}})</h4>
|
||||
<a class="btn rounded gray">{{=a}} ({{=T('currently running')}})</a>
|
||||
{{else:}}
|
||||
<h4 class="editableapp">{{=A(a,_href=URL(a,'default','index'))}}</h4>
|
||||
<a class="btn rounded orange" href="{{=URL(a,'default','index')}}">{{=a}}</a>
|
||||
{{if MULTI_USER_MODE and db.app(name=a):}}(created by {{="%(first_name)s %(last_name)s" % db.auth_user[db.app(name=a).owner]}}){{pass}}
|
||||
{{if not os.path.exists('applications/%s/compiled' % a):}}
|
||||
{{buttons.append((URL('design',args=a), T("Edit")))}}
|
||||
@@ -43,28 +43,30 @@
|
||||
{{if a!=request.application:}}
|
||||
{{buttons.append((URL('uninstall',args=a), T("Uninstall")))}}
|
||||
{{pass}}
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
{{=T('Manage')}}
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{{for link,name in buttons:}}
|
||||
{{=LI(A(name,_href=link))}}
|
||||
</td>
|
||||
<td>
|
||||
<ul class="menu">
|
||||
<li>
|
||||
<a class="btn white rounded">{{=T('Manage')}}</a>
|
||||
<ul>
|
||||
{{for link,name in buttons:}}
|
||||
{{=LI(A(name,_href=link))}}
|
||||
{{pass}}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
{{=button_enable(URL('enable',args=a), a) if a!='admin' else ''}}
|
||||
</td>
|
||||
</tr>
|
||||
{{pass}}
|
||||
</ul>
|
||||
</div>
|
||||
{{=button_enable(URL('enable',args=a), a) if a!='admin' else ''}}
|
||||
</td>
|
||||
</tr>
|
||||
{{pass}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- /applist -->
|
||||
<div class="sidebar fl60 span5">
|
||||
<div class="sidebar_inner controls well well-small">
|
||||
<div class="third black">
|
||||
<div class="padded">
|
||||
<!-- CHANGE ADMIN PWD -->
|
||||
<div class="pwdchange pull-right">
|
||||
{{if MULTI_USER_MODE:}}
|
||||
@@ -77,77 +79,77 @@
|
||||
{{if is_manager():}}
|
||||
<!-- VERSION -->
|
||||
<div class="box">
|
||||
<h4>{{=T("Version")}}</h4>
|
||||
<p>
|
||||
<tt>{{=myversion}}</tt><br/>
|
||||
{{running_on = T("Running on %s", request.env.server_software or 'Unknown')}}
|
||||
({{="%s, Python %s" % (running_on, myplatform)}})
|
||||
</p>
|
||||
<p id="check_version" class="row-buttons">
|
||||
{{if session.check_version:}}
|
||||
{{=T('Checking for upgrades...')}}
|
||||
<script>ajax('{{=URL('check_version')}}',[],'check_version');</script>
|
||||
{{session.check_version=False}}
|
||||
{{else:}}
|
||||
{{=button("javascript:ajax('"+URL('check_version')+"',[],'check_version')", T('Check for upgrades'))}}
|
||||
{{pass}}
|
||||
</p>
|
||||
{{if session.is_mobile=='auto':}}
|
||||
<p>{{=A(T('Try the mobile interface'),_href=URL('plugin_jqmobile','about'))}}</p>
|
||||
{{pass}}
|
||||
<h6>{{=T("Version")}}</h6>
|
||||
<p>
|
||||
<tt>{{=myversion}}</tt><br/>
|
||||
{{running_on = T("Running on %s", request.env.server_software or 'Unknown')}}
|
||||
({{="%s, Python %s" % (running_on, myplatform)}})
|
||||
</p>
|
||||
<p id="check_version" class="row-buttons">
|
||||
{{if session.check_version:}}
|
||||
{{=T('Checking for upgrades...')}}
|
||||
<script>ajax('{{=URL('check_version')}}',[],'check_version');</script>
|
||||
{{session.check_version=False}}
|
||||
{{else:}}
|
||||
{{=button("javascript:ajax('"+URL('check_version')+"',[],'check_version')", T('Check for upgrades'))}}
|
||||
{{pass}}
|
||||
</p>
|
||||
{{if session.is_mobile=='auto':}}
|
||||
<p>{{=A(T('Try the mobile interface'),_href=URL('plugin_jqmobile','about'))}}</p>
|
||||
{{pass}}
|
||||
</div> <!-- /VERSION -->
|
||||
{{pass}}
|
||||
{{if MULTI_USER_MODE and is_manager():}}
|
||||
<!-- MULTI_USER_INTERFACE -->
|
||||
<div class="box">
|
||||
<h4>{{=T("Multi User Mode")}}</h4>
|
||||
<p class="row-buttons">
|
||||
{{=button(URL('bulk_register'),T('Bulk Register'))}}
|
||||
{{=button(URL('manage_students',vars={'order':'auth_user.id'}),T('Manage Students'))}}
|
||||
</p>
|
||||
<h6>{{=T("Multi User Mode")}}</h6>
|
||||
<p class="row-buttons">
|
||||
{{=button(URL('bulk_register'),T('Bulk Register'))}}
|
||||
{{=button(URL('manage_students',vars={'order':'auth_user.id'}),T('Manage Students'))}}
|
||||
</p>
|
||||
</div> <!-- /MULTI_USER_INTERFACE -->
|
||||
{{pass}}
|
||||
<!-- SCAFFOLD APP -->
|
||||
<div class="box">
|
||||
<h4>{{=T("New simple application")}}</h4>
|
||||
{{=form_create.custom.begin}}
|
||||
{{=LABEL(T("Application name:"))}}
|
||||
{{=form_create.custom.widget.name}}
|
||||
<div class="controls"><button type="submit" class="btn">{{=T('Create')}}</button></div>
|
||||
{{=form_create.custom.end}}
|
||||
<h6>{{=T("New simple application")}}</h6>
|
||||
{{=form_create.custom.begin}}
|
||||
{{=LABEL(T("Application name:"))}}
|
||||
{{=form_create.custom.widget.name}}
|
||||
<div class="controls"><button type="submit" class="btn">{{=T('Create')}}</button></div>
|
||||
{{=form_create.custom.end}}
|
||||
</div> <!-- /SCAFFOLD APP -->
|
||||
<!-- UPLOAD PACKAGE -->
|
||||
<div class="box">
|
||||
<h4>{{=T("Upload and install packed application")}}</h4>
|
||||
{{=form_update.custom.begin}}
|
||||
<label for="appupdate_name">{{=T("Application name:")}}</label>
|
||||
{{=form_update.custom.widget.name}}
|
||||
<label for="appupdate_file">{{=T("Upload a package:")}}</label>
|
||||
{{=form_update.custom.widget.file}}
|
||||
<label for="appupdate_url">{{=T("Or Get from URL:")}}</label>
|
||||
{{=form_update.custom.widget.url}}<small class="help-block">({{=T('can be a git repo')}})</small>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
{{=form_update.custom.widget.overwrite}} {{=T("Overwrite installed app")}}
|
||||
</label>
|
||||
<button type="submit" class='btn'>{{=T('Install')}}</button>
|
||||
</div>
|
||||
{{=form_update.custom.end}}
|
||||
<h6>{{=T("Upload and install packed application")}}</h6>
|
||||
{{=form_update.custom.begin}}
|
||||
<label for="appupdate_name">{{=T("Application name:")}}</label>
|
||||
{{=form_update.custom.widget.name}}
|
||||
<label for="appupdate_file">{{=T("Upload a package:")}}</label>
|
||||
{{=form_update.custom.widget.file}}
|
||||
<label for="appupdate_url">{{=T("Or Get from URL:")}}</label>
|
||||
{{=form_update.custom.widget.url}}<small class="help-block">({{=T('can be a git repo')}})</small>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
{{=form_update.custom.widget.overwrite}} {{=T("Overwrite installed app")}}
|
||||
</label>
|
||||
<button type="submit" class='btn'>{{=T('Install')}}</button>
|
||||
</div>
|
||||
{{=form_update.custom.end}}
|
||||
</div> <!-- /UPLOAD PACKAGE -->
|
||||
<!-- DEPLOY ON GAE -->
|
||||
<div class="box">
|
||||
<h4>{{=T("Deploy")}}</h4>
|
||||
<p class="row-buttons">
|
||||
{{=button(URL('gae','deploy'), T('Deploy on Google App Engine'))}}
|
||||
{{=button(URL('openshift','deploy'),T('Deploy to OpenShift'))}}
|
||||
{{=button(URL('pythonanywhere','deploy'), T('Deploy to PythonAnywhere'))}}
|
||||
</p>
|
||||
<h6>{{=T("Deploy")}}</h6>
|
||||
<p class="row-buttons">
|
||||
{{=button(URL('gae','deploy'), T('Deploy on Google App Engine'))}}
|
||||
{{=button(URL('openshift','deploy'),T('Deploy to OpenShift'))}}
|
||||
{{=button(URL('pythonanywhere','deploy'), T('Deploy to PythonAnywhere'))}}
|
||||
</p>
|
||||
</div> <!-- /DEPLOY ON GAE -->
|
||||
<!-- APP WIZARD -->
|
||||
<div class="box">
|
||||
<h4>{{=T("New application wizard")}}</h4>
|
||||
<p>{{=button(URL('wizard','index'), T('Start wizard'))}}<br/>
|
||||
{{=T("(requires internet access, experimental)")}}</p>
|
||||
<h6>{{=T("New application wizard")}}</h6>
|
||||
<p>{{=button(URL('wizard','index'), T('Start wizard'))}}<br/>
|
||||
{{=T("(requires internet access, experimental)")}}</p>
|
||||
</div> <!-- /APP WIZARD -->
|
||||
<!-- TWITTER TIMELINE -->
|
||||
<div class="box twitter-timeline">
|
||||
|
||||
@@ -1,114 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="P3P" content="CP=\"IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA\"" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{=response.title or URL()}}</title>
|
||||
{{
|
||||
response.files.append(URL('static','css/bootstrap.min.css'))
|
||||
response.files.append(URL('static','css/bootstrap_essentials.css'))
|
||||
response.files.append(URL('static','css/bootstrap-responsive.min.css'))
|
||||
}}
|
||||
{{include 'web2py_ajax.html'}}
|
||||
</head>
|
||||
|
||||
<body class="{{=T('direction: ltr') == 'direction: rtl' and 'RTLbody' or ''}} {{block sectionclass}}home{{end}}">
|
||||
|
||||
<!-- NAVBAR
|
||||
============== -->
|
||||
<div id="header" class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<div id="start" class="brand_wrapper">
|
||||
<a href="{{=URL('default', 'index')}}" class="button brand" ><span>web2py™ {{=T('administrative interface')}}</span></a>
|
||||
</div>
|
||||
<div class="nav-collapse">
|
||||
{{if response.menu is not None:}}
|
||||
<ul id="menu" class="nav pull-right">
|
||||
{{for _name,_active,_link in response.menu:}}
|
||||
<li>{{=A(SPAN(_name), _href=_link, _class=_active and 'button select' or 'button')}}</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
{{pass}}
|
||||
</div><!--/.nav-collapse -->
|
||||
</div><!-- /container-fluid -->
|
||||
</div><!-- /navbar-inner -->
|
||||
</div><!-- /#header -->
|
||||
|
||||
<!-- MAIN
|
||||
=========== -->
|
||||
<div id="{{=globals().get('main_id', 'main')}}" class="container-fluid">
|
||||
<div id="main_inner" class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="w2p_flash alert">{{=response.flash or ''}}</div>
|
||||
{{include}}
|
||||
</div><!-- /main span12 -->
|
||||
</div><!-- /main row-fluid -->
|
||||
</div><!-- /#main -->
|
||||
|
||||
<!-- FOOTER
|
||||
============== -->
|
||||
{{block footer}}
|
||||
<footer id="footer" class="fixed">
|
||||
<p><span>{{=T('Powered by')}} {{=A('web2py', _href='http://www.web2py.com')}}™ {{=T('created by')}} Massimo Di Pierro ©2007-{{=request.now.year}}
|
||||
{{if hasattr(T,'get_possible_languages_info'):}}
|
||||
- {{=T('Admin language')}}</span>
|
||||
<select name="adminlanguage" onchange="var date = new Date();cookieDate=date.setTime(date.getTime()+(100*24*60*60*1000));document.cookie='adminLanguage='+this.options[this.selectedIndex].id+'; expires='+cookieDate+'; path=/';window.location.reload()">
|
||||
{{for langinfo in sorted([(code,info[1]) for code,info in T.get_possible_languages_info().iteritems() if code != 'default']):}}
|
||||
<option {{=T.accepted_language==langinfo[0] and 'selected' or ''}} {{='id='+langinfo[0]}} >{{=langinfo[1]}}</option>
|
||||
{{pass}}
|
||||
</select>
|
||||
{{else:}}
|
||||
</span>{{pass}}
|
||||
</p>
|
||||
</footer><!-- /#footer -->
|
||||
{{end}}
|
||||
|
||||
<!-- BS JAVASCRIPT
|
||||
====================== -->
|
||||
<script src="{{=URL('static','js/bootstrap.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
jQuery("[rel=tooltip]").tooltip();
|
||||
jQuery(":input").attr("autocomplete","off");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// ====================
|
||||
// upload input mask
|
||||
// ====================
|
||||
|
||||
function FileSelectHandler(e) {
|
||||
e.stopPropagation();
|
||||
var filename = e.target.value.split(/\\|\//).pop();
|
||||
jQuery('#fileselect>span').removeClass('txtPlaceholder').text(filename)
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
var iupload = jQuery('#appupdate_file');
|
||||
var ow = 300, oh = 20;
|
||||
var iplaceholder = jQuery('<span class="txtPlaceholder">{{=T("no package selected")}}</span>'),
|
||||
iuploadbtn = jQuery('<button class="btn btn-inverse btn-mini uploadbtn"><i class="icon-white icon-circle-arrow-up"></i></button>');
|
||||
iupload
|
||||
.addClass('masked')
|
||||
.wrap('<div id="fileselect" style="width:'+ow+'px;height:'+oh+'px"></div>')
|
||||
.on('change', function(event){FileSelectHandler(event)});
|
||||
jQuery('#fileselect').append(iplaceholder, iuploadbtn);
|
||||
});
|
||||
</script>
|
||||
|
||||
{{if request.function in ('index','site'):}}
|
||||
<a style="position:fixed;bottom:0;left:0;z-index:1000" href="https://groups.google.com/forum/?fromgroups#!forum/web2py" target="_blank">
|
||||
<!-- http://webchat.freenode.net/?channels=web2py" //-->
|
||||
<img src="{{=URL('static','images/questions.png')}}" />
|
||||
</a>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<link href="{{=URL('static','css/stupid.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{=URL('static','css/calendar.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{=URL('static','css/web2py.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<style>
|
||||
th, td {color: black}
|
||||
tbody tr:hover {background-color:transparent}
|
||||
tbody tr {border-bottom: none}
|
||||
p {text-align: left}
|
||||
pre {background-color: black!important;border-radius:5px; color:white; padding:10px}
|
||||
a.btn.btn180 {padding:20px; font-size:1.2em; width:200px!important}
|
||||
[type=submit], [type=button] {border-radius:5px!important;padding:5px 10px;margin-top:10px}
|
||||
</style>
|
||||
{{
|
||||
left_sidebar_enabled = globals().get('left_sidebar_enabled', False)
|
||||
right_sidebar_enabled = globals().get('right_sidebar_enabled', False)
|
||||
middle_column = {0: 'fill', 1: 'threequarters', 2: 'half'}[
|
||||
(left_sidebar_enabled and 1 or 0)+(right_sidebar_enabled and 1 or 0)]
|
||||
}}
|
||||
{{include "web2py_ajax.html"}}
|
||||
</head>
|
||||
<body class="black">
|
||||
<header class="black padded">
|
||||
<div class="container middle max900">
|
||||
<div class="fill middle">
|
||||
<label class="ham padded fa fa-bars" for="menu"></label>
|
||||
<div class="burger accordion">
|
||||
<input type="checkbox" id="menu"/>
|
||||
{{=MENU(response.menu,_class='menu')}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{{if response.flash:}}
|
||||
<div class="w2p_flash">
|
||||
{{=response.flash}}
|
||||
</div>
|
||||
{{pass}}
|
||||
<main class="white">
|
||||
<div class="hidden">{{block sectionclass}}design{{end}}</div>
|
||||
<div class="container max900">
|
||||
{{if left_sidebar_enabled:}}
|
||||
<div class="quarter padded">{{block left_sidebar}}{{end}}</div>
|
||||
{{pass}}
|
||||
</body>
|
||||
<div class="{{=middle_column}} padded">{{include}}</div>
|
||||
{{if right_sidebar_enabled:}}
|
||||
<div class="quarter padded">{{block right_sidebar}}{{end}}</div>
|
||||
{{pass}}
|
||||
</div>
|
||||
</main>
|
||||
<footer class="black">
|
||||
<div class="container padded max900">
|
||||
<div class="fill">
|
||||
Copyright @ 2016 - Powered by Web2py
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
<script>
|
||||
// prevent android horizontal scrolling
|
||||
window.addEventListener("scroll", function(){window.scroll(0, window.pageYOffset);}, false);
|
||||
</script>
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
var w2p_ajax_confirm_message = "{{=T('Are you sure you want to delete this object?')}}";
|
||||
var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}";
|
||||
var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d %H:%M:%S')}}";
|
||||
var w2p_ajax_disable_with_message = "{{=T('Working...')}}";
|
||||
var ajax_error_500 = '{{=T.M('An error occured, please [[reload %s]] the page') % URL(args=request.args, vars=request.get_vars) }}'
|
||||
//--></script>
|
||||
{{
|
||||
|
||||
@@ -10,7 +10,7 @@ session.forget()
|
||||
cache_expire = not request.is_local and 300 or 0
|
||||
|
||||
|
||||
# @cache.action(time_expire=300, cache_model=cache.ram, quick='P')
|
||||
@cache.action(time_expire=300, cache_model=cache.ram, quick='P')
|
||||
def index():
|
||||
return response.render()
|
||||
|
||||
@@ -19,13 +19,14 @@ def index():
|
||||
def what():
|
||||
import urllib
|
||||
try:
|
||||
images = XML(urllib.urlopen('http://www.web2py.com/poweredby/default/images').read())
|
||||
images = XML(urllib.urlopen(
|
||||
'http://www.web2py.com/poweredby/default/images').read())
|
||||
except:
|
||||
images = []
|
||||
return response.render(images=images)
|
||||
|
||||
|
||||
# @cache.action(time_expire=300, cache_model=cache.ram, quick='P')
|
||||
#@cache.action(time_expire=300, cache_model=cache.ram, quick='P')
|
||||
def download():
|
||||
return response.render()
|
||||
|
||||
@@ -73,15 +74,14 @@ def license():
|
||||
filename = os.path.join(request.env.gluon_parent, 'LICENSE')
|
||||
return response.render(dict(license=MARKMIN(read_file(filename))))
|
||||
|
||||
|
||||
def version():
|
||||
if request.args(0) == 'raw':
|
||||
if request.args(0)=='raw':
|
||||
return request.env.web2py_version
|
||||
from gluon.fileutils import parse_version
|
||||
(a, b, c, pre_release, build) = parse_version(request.env.web2py_version)
|
||||
return 'Version %i.%i.%i (%.4i-%.2i-%.2i %.2i:%.2i:%.2i) %s' % \
|
||||
(a, b, c, build.year, build.month, build.day, build.hour, build.minute, build.second, pre_release)
|
||||
|
||||
return 'Version %i.%i.%i (%.4i-%.2i-%.2i %.2i:%.2i:%.2i) %s' % (
|
||||
a,b,c,build.year,build.month,build.day,
|
||||
build.hour,build.minute,build.second,pre_release)
|
||||
|
||||
@cache.action(time_expire=300, cache_model=cache.ram, quick='P')
|
||||
def examples():
|
||||
|
||||
@@ -35,6 +35,12 @@ def hello6():
|
||||
response.flash = 'Hello World in a flash!'
|
||||
return dict(message=T('Hello World'))
|
||||
|
||||
|
||||
def status():
|
||||
""" page that shows internal status"""
|
||||
return dict(toolbar=response.toolbar())
|
||||
|
||||
|
||||
def redirectme():
|
||||
""" redirects to /{{=request.application}}/{{=request.controller}}/hello3 """
|
||||
|
||||
|
||||
@@ -27,4 +27,4 @@ def xml():
|
||||
|
||||
|
||||
def beautify():
|
||||
return dict(message=BEAUTIFY(dict(a=1,b=[2,3,dict(hello='world')])))
|
||||
return dict(message=BEAUTIFY(request))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
response.menu = [
|
||||
(T('Home'), request.controller == 'default' and request.function == 'index', URL('default', 'index')),
|
||||
(T('About'), request.controller == 'default' and request.function == 'what', URL('default', 'what')),
|
||||
(T('Download'), request.controller == 'default' and request.function == 'download', URL('default', 'download')),
|
||||
(T('Docs & Resources'), request.controller == 'default' and request.function == 'documentation', URL('default', 'documentation')),
|
||||
(T('Support'), request.controller == 'default' and request.function == 'support', URL('default', 'support')),
|
||||
(T('Contributors'), request.controller == 'default' and request.function == 'who', URL('default', 'who'))]
|
||||
(T('Home'), False, URL('default', 'index')),
|
||||
(T('About'), False, URL('default', 'what')),
|
||||
(T('Download'), False, URL('default', 'download')),
|
||||
(T('Docs & Resources'), False, URL('default', 'documentation')),
|
||||
(T('Support'), False, URL('default', 'support')),
|
||||
(T('Contributors'), False, URL('default', 'who'))]
|
||||
|
||||
#########################################################################
|
||||
## Changes the menu active item
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
from gluon.utils import web2py_uuid
|
||||
cookie_key = cache.ram('cookie_key',lambda: web2py_uuid(),None)
|
||||
session.connect(request,response,cookie_key=cookie_key)
|
||||
session.connect(request,response,cookie_key='yoursecret')
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
- [[Intro video http://www.youtube.com/watch?v=BXzqmHx6edY]] and [[code examples https://github.com/mjhea0/web2py]]
|
||||
- [[Step by step tutorial https://milesm.pythonanywhere.com/wiki]]
|
||||
- [[web2py Reference Project http://www.web2pyref.com/]]
|
||||
- [[An advanced tutorial https://milesm.pythonanywhere.com/wiki]]
|
||||
- [[Killer Web Development Tutorial http://killer-web-development.com/]]
|
||||
- [[Real Python for the Web http://www.realpython.com]] (web development with web2py and more!)
|
||||
- [[Admin Demo http://www.web2py.com/demo_admin popup]] (web-based IDE)
|
||||
@@ -20,9 +19,9 @@
|
||||
|
||||
#### Code
|
||||
- [[web2pyslices (recipes) http://www.web2pyslices.com popup]]
|
||||
- [[Dashboard welcome app https://github.com/mjbeller/web2py-starter]]
|
||||
- [[stupid.css theme https://github.com/mdipierro/web2py-welcome-theme-stupid]]
|
||||
- [[Layouts http://www.web2py.com/layouts popup]]
|
||||
- [[Plugins http://www.web2py.com/plugins popup]]
|
||||
- [[More Plugins http://dev.s-cubism.com/web2py_plugins]]
|
||||
- [[Appliances http://www.web2py.com/appliances popup]]
|
||||
- [[web2py utils http://packages.python.org/web2py_utils/ popup]]
|
||||
- [[Sublime text 3 plugin https://bitbucket.org/kfog/w2p popup]]
|
||||
|
||||
@@ -1,69 +1,20 @@
|
||||
/* Gray the black as suggested by Anthony */
|
||||
h1,h2,h3,h4,h5,h6 {color: rgb(35, 35, 35); text-transform:none}
|
||||
.black {
|
||||
color: rgb(35, 35, 35);
|
||||
background-color: rgb(35, 35, 35);
|
||||
}
|
||||
|
||||
/* Spacing between thead and tbody */
|
||||
/* Ref: http://stackoverflow.com/questions/9258754/spacing-between-thead-and-tbody */
|
||||
tbody:before {
|
||||
content: "-";
|
||||
display: block;
|
||||
line-height: 1em;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
/* Improve buttons in download page */
|
||||
th, td {padding: 0}
|
||||
|
||||
|
||||
tbody tr:hover {background-color:transparent}
|
||||
tbody tr {border-bottom: none}
|
||||
p {text-align: left}
|
||||
p, li { line-height: 1.6em}
|
||||
|
||||
/* Improve CODE() display though padding has no effect as some PRE are hardcoded somewhere can't find it */
|
||||
/* padding of 10px should make it... */
|
||||
pre {background-color: rgb(35, 35, 35)!important; border-radius:5px; color:white; padding: 10px}
|
||||
|
||||
/* Improve buttons in download page */
|
||||
a.btn.btn180 {padding:10px; font-size:1.2em; width:200px}
|
||||
|
||||
.menu .web2py-menu-active a {
|
||||
color: #26a69a;
|
||||
}
|
||||
|
||||
.spaced-vertical {
|
||||
margin: 0 0.5em 0.5em 0;
|
||||
}
|
||||
|
||||
.btn:hover,
|
||||
a.noeffect img:hover {
|
||||
transition: scale .5s;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.btn,
|
||||
a.noeffect img {
|
||||
transition: all .2s ease-in-out;
|
||||
}
|
||||
|
||||
/* Lower saturation of color #26a69a - 20 points lower */
|
||||
/* The below change to color #26a69a should come before other color change or they override all buttons background-color */
|
||||
/* The color should maybe change at stupid.css level as it herited from there also in stupid.css it would be better
|
||||
to define this color at one place actually color is defined all over the place */
|
||||
a {color:#47a69d}
|
||||
.btn, button, [type=button], [type=submit] {background-color:#47a69d}
|
||||
.progress .determinate {background-color:#47a69d}
|
||||
.progress .indeterminate {background-color:#47a69d}
|
||||
a:not(.btn):not(.noeffect):hover {color:#47a69d}
|
||||
a:not(.btn):not(.noeffect):after {background-color:#47a69d}
|
||||
.tags > span {background-color:#47a69d}
|
||||
.tags.dismissible > span.off:hover {background-color:#47a69d}
|
||||
.aquamarine{background-color:#47a69d}
|
||||
|
||||
/* Lower the saturation of 20 points */
|
||||
.green {background-color: #58cc65}
|
||||
.yellow {background-color: #ffe333}
|
||||
.red {background-color: #cc4229}
|
||||
@import url(http://fonts.googleapis.com/css?family=Economica);
|
||||
@@import url(http://fonts.googleapis.com/css?family=Belleza);
|
||||
|
||||
body { font-family: Arial, Helvetica; }
|
||||
a, a:visited, a:hover, h1,h2,h3,h4,h5 {color: #658883}
|
||||
a.btn-danger, a.btn-warning, a.btn-success {color:white}
|
||||
h1,h2,h3,h4,h5 { font-family: "Economica", Arial, Helevtica; }
|
||||
body {
|
||||
background: url('../images/stripes.png') repeat-x;
|
||||
}
|
||||
#header {
|
||||
margin-top: 40px;
|
||||
}
|
||||
.btn-180 {
|
||||
width: 180px;
|
||||
}
|
||||
.page-header {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
************/
|
||||
|
||||
/*** basic styles ***/
|
||||
html {box-sizing:border-box;}
|
||||
*, *:after, *:before {border:0; margin:0; padding:0; box-sizing:inherit;}
|
||||
html, body {max-width: 100vw; overflow-x: hidden}
|
||||
* {border:0; margin:0; padding:0; font-familiy:Helvetica}
|
||||
html, body {max-width: 100vw !important;overflow-x: hidden !important}
|
||||
body {font-family:"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif}
|
||||
p, li {margin-bottom:0.5em}
|
||||
p {text-align:justify}
|
||||
@@ -15,7 +14,7 @@ label, strong {font-weight:bold}
|
||||
ul {list-style-type:none; padding-left:20px}
|
||||
a {text-decoration:none; color:#26a69a; white-space:nowrap}
|
||||
a:hover {cursor:pointer}
|
||||
h1,h2,h3,h4,h5,h6{font-weight:bold; text-transform:uppercase}
|
||||
h1,h2,h3,h4,h5,h6{font-weight:strong; text-transform:uppercase}
|
||||
h1{font-size:4em; margin:1.0em 0 0.25em 0}
|
||||
h2{font-size:2.4em; margin:0.9em 0 0.25em 0}
|
||||
h3{font-size:1.8em; margin:0.8em 0 0.25em 0}
|
||||
@@ -24,13 +23,15 @@ h5{font-size:1.4em; margin:0.6em 0 0.25em 0}
|
||||
h6{font-size:1.2em; margin:0.5em 0 0.25em 0}
|
||||
table {border-collapse:collapse}
|
||||
tbody tr:hover {background-color:#fbf6d9}
|
||||
td, th {padding:5px; vertical-align:top; text-align:left; border:0}
|
||||
thead tr {background-color:#f1f1f1}
|
||||
tbody tr {border-bottom:2px solid #f1f1f1}
|
||||
td, th {padding: 5px; text-align: left; vertical-align:top}
|
||||
th {font-weight:string; padding:5px; vertical-align:bottom; text-align:left}
|
||||
thead th {vertical-align:bottom}
|
||||
header, main, footer {display:block; with:100%} /* IE fix */
|
||||
tbody th {vertical-align:top}
|
||||
header, footer {with:100%}
|
||||
|
||||
@media all and (max-width:599px) {
|
||||
@media (max-width:599px) {
|
||||
h1{font-size:2em}
|
||||
h2{font-size:1.8em}
|
||||
h3{font-size:1.6em}
|
||||
@@ -40,22 +41,22 @@ header, main, footer {display:block; with:100%} /* IE fix */
|
||||
}
|
||||
|
||||
/*** buttons ***/
|
||||
.btn, button, [type=button], [type=submit] {padding:0.5em 1em; margin:0 0.5em 0.5em 0; display:inline-block; background-color:#26a69a; color:white}
|
||||
.btn, button, [type=button], [type=submit] {padding:0.5em 1em !important; margin:0 0.5em 0.5em 0; line-height:2.4em; background-color:#26a69a; color:white}
|
||||
.btn:hover, button:hover, [type=button]:hover, [type=submit]:hover {box-shadow:0 0 10px #666; text-decoration:none; cursor:pointer}
|
||||
.btn.small, table .btn {padding:0.25em 0.5em; font-size:0.8em}
|
||||
.btn.large {padding:1em 2em; font-size:1.2em}
|
||||
.btn.small, table .btn {padding:0.25em 0.5em !important; font-size:0.8em; line-height:1.5em}
|
||||
.btn.large {padding:1em 2em !important; font-size:1.2em; line-height:4em}
|
||||
.btn.oval {border-radius:50%}
|
||||
|
||||
/*** helpers ***/
|
||||
.rounded {-moz-border-radius:5px; border-radius:5px}
|
||||
.padded {padding:10px 20px}
|
||||
.center {text-align:center; margin-left:auto; margin-right:auto}
|
||||
.padded {padding:10px 20px !important; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box}
|
||||
.center {text-align:center !important; margin-left:auto; margin-right:auto}
|
||||
.center>div {text-align:left}
|
||||
.right {right:0; text-align:right}
|
||||
.middle div {vertical-align:middle}
|
||||
.bottom div {vertical-align:bottom}
|
||||
.xscroll {overflow-x:scroll}
|
||||
.yscroll {overflow-y:scroll}
|
||||
.middle div {vertical-align:middle !important}
|
||||
.bottom div {vertical-align:bottom !important}
|
||||
.xscroll {overflow-x:scroll; width:100%}
|
||||
.yscroll {overflow-y:scroll; width:100%}
|
||||
.nowrap {white-space:nowrap; overflow-x:hidden}
|
||||
.fill {width:100%}
|
||||
.lifted {box-shadow:5px 5px 10px #666}
|
||||
@@ -65,20 +66,18 @@ header, main, footer {display:block; with:100%} /* IE fix */
|
||||
.hidden {display:none}
|
||||
|
||||
/*** forms ***/
|
||||
input:not([type]), input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]), [type=file]:before {outline:none; padding:0.5em 1em; margin:0.5px; border-bottom:1px solid #ddd; width:100%}
|
||||
input:not([type]), input:not([type=checkbox]):not([type=radio]):not([type=submit]), [type=file]:before {outline:none; padding:0.5em 1em; margin:0.5px; border-bottom:1px solid #ddd; width:100%}
|
||||
textarea {width:100%; border:1px solid #ddd; padding:4px 8px; outline:none; outline:none}
|
||||
select {-webkit-appearance:none; outline:none; padding:0.5em 1em; border-radius:0; margin:0.5px; border-bottom:1px solid #ddd; width:100%;background-color:transparent}
|
||||
select {-webkit-appearance:none; outline:none; padding:0.5em 1em; border-radius:0; margin:0.5px; border-bottom:1px solid #ddd}
|
||||
input, textarea, select, button {font-size:12px}
|
||||
input:not([type]):hover, input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]):hover, select:hover, textarea:hover {background-color:#fbf6d9; transition:background-color 1s ease}
|
||||
input:invalid, input.error {background:#cc1f00;color:white}
|
||||
input:not([type]), input:not([type=checkbox]):not([type=radio]):not([type=submit]):hover, select:hover, textarea:hover {background-color:#fbf6d9; transition:background-color 1s ease}
|
||||
|
||||
/*** grid ***/
|
||||
.container {margin-right:-20px}
|
||||
.container>.quarter, .container>.half, .container>.third, .container>.twothirds, .container>.threequarters {display:inline-block; padding: 0 20px 0 0; vertical-align:top}
|
||||
.container>.fill{display: inline-block}
|
||||
.container>.quarter, .container>.half, .container>.third, .container>.twothirds, .container>.threequarters, .container>.fill{display:inline-block; padding:5px 20px 5px 0; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; vertical-align:top}
|
||||
.container>.fill {width:100%; margin-right:-20px}
|
||||
.container img, .container video {max-width:100%}
|
||||
|
||||
@media all and (min-width:800px) {
|
||||
@media (min-width:800px) {
|
||||
.max900 {max-width:900px; margin-left:auto; margin-right:auto}
|
||||
.quarter {width:25%; margin-right:-5px}
|
||||
.half {width:50%; margin-right:-10px}
|
||||
@@ -86,7 +85,7 @@ input:invalid, input.error {background:#cc1f00;color:white}
|
||||
.twothirds {width:66.66%; margin-right:-13.33px}
|
||||
.threequarters {width:75%; margin-right:-15px}
|
||||
}
|
||||
@media all and (min-width:600px) and (max-width:799px) {
|
||||
@media (min-width:600px) and (max-width:799px) {
|
||||
.quarter.compressible {width:25%; margin-right:-5px}
|
||||
.half.compressible {width:50%; margin-right:-10px}
|
||||
.threequarters.compressible {width:75%; margin-right:-15px}
|
||||
@@ -95,7 +94,7 @@ input:invalid, input.error {background:#cc1f00;color:white}
|
||||
.twothirds {width:66.66%; margin-right:-13.33px}
|
||||
label.quarter:not(.compressible).right, label.half:not(.compressible).right, label.threequarters:not(.compressible).right {float:left; text-align:left}
|
||||
}
|
||||
@media all and (max-width:599px) {
|
||||
@media (max-width:599px) {
|
||||
.quarter:not(.compressible), .half:not(.compressible), .third:not(.compressible), .twothirds:not(.compressible), .threequarters:not(.compressible) {width:100%;}
|
||||
label.quarter:not(.compressible).right, label.half:not(.compressible).right, label.threequarters:not(.compressible).right,
|
||||
label.third:not(.compressible).right, label.twothirds:not(.compressible).right {float:left; text-align:left}
|
||||
@@ -115,7 +114,7 @@ input:invalid, input.error {background:#cc1f00;color:white}
|
||||
display:block;
|
||||
width:120%;
|
||||
background-color:#acece6;
|
||||
border-radius:0;
|
||||
border-radius:0 !important;
|
||||
background-clip:padding-box;
|
||||
overflow:hidden;
|
||||
}
|
||||
@@ -190,20 +189,20 @@ input:invalid, input.error {background:#cc1f00;color:white}
|
||||
.menu ul {background:white; border:1px solid #e1e1e1; visibility:hidden; opacity:0; position:absolute; top:110%; padding:0; z-index:1000; transition:all 0.2s ease-out; list-style-type:none; box-shadow:5px 5px 10px #666}
|
||||
.menu ul a {padding:10px 15px; color:#333; font-weight:700; font-size:12px; line-height:16px; display: block}
|
||||
.menu ul li {float:none; width:200px}
|
||||
.menu ul ul {top:0; left:80%; z-index:1100}
|
||||
.menu ul ul {top:0; left:80%; z-index:2000}
|
||||
.menu li:hover > ul {visibility:visible; opacity:1}
|
||||
.menu>li>ul>li:first-child:before{content:''; position:absolute; width:1px; height:1px; border:10px solid transparent; left:50px; top:-20px; margin-left:-10px; border-bottom-color:white}
|
||||
.menu.dark ul {background:#111111; border:1px solid #111111}
|
||||
.menu.dark ul {background:black; border:1px solid black}
|
||||
.menu.dark ul a {color:white}
|
||||
.menu.dark>li>ul>li:first-child:before{border-bottom-color:#111111}
|
||||
.menu.dark>li>ul>li:first-child:before{border-bottom-color:black}
|
||||
|
||||
@media all and (max-width:599px) {
|
||||
@media (max-width:599px) {
|
||||
header .menu li, header .menu ul {width: 100%}
|
||||
header .menu.right {float:left; text-align:left}
|
||||
header .menu ul ul {top:2.5em; left:-1px}
|
||||
header .menu ul ul {top:2.5em; left:-1px; z-index:2000}
|
||||
}
|
||||
|
||||
@media all and (min-width:600px) {
|
||||
@media (min-width:600px) {
|
||||
.ham {display:none!important}
|
||||
.burger.accordion * {max-height:1000px; overflow:visible}
|
||||
}
|
||||
@@ -265,30 +264,24 @@ a:not(.btn):not(.noeffect):after {
|
||||
|
||||
/*** tooltips from http://codepen.io/trezy/pen/Khnzy ***/
|
||||
[data-tooltip] {position:relative}
|
||||
[data-tooltip]:before, [data-tooltip]:after {display:none; position:absolute; top:0}
|
||||
[data-tooltip]:hover:after,[data-tooltip]:hover:before {display:block}
|
||||
[data-tooltip]:hover:before {
|
||||
border-bottom:.6em solid #111111;
|
||||
border-bottom:.6em solid #111111;
|
||||
[data-tooltip]:before, [data-tooltip]:after {display:none; position:absolute; top:0}
|
||||
[data-tooltip]:before {
|
||||
border-bottom:.6em solid black;
|
||||
border-bottom:.6em solid black;
|
||||
border-left:7px solid transparent;
|
||||
border-right:7px solid transparent;
|
||||
content:"";
|
||||
left:0;
|
||||
margin-top:12px;
|
||||
z-index:2000;
|
||||
left:20px;
|
||||
margin-top:1em;
|
||||
}
|
||||
[data-tooltip]:hover:after {
|
||||
z-index:2000;
|
||||
[data-tooltip]:after {
|
||||
background-color:rgba(0,0,0,0.8);
|
||||
border:4px solid rgba(0,0,0,0.8);
|
||||
border-radius:7px;
|
||||
color:white;
|
||||
text-transform:none;
|
||||
font-size: 12px;
|
||||
content:attr(data-tooltip);
|
||||
left:0;
|
||||
top:2px;
|
||||
margin-left:-20px;
|
||||
margin-top:1.5em;
|
||||
padding:5px 15px;
|
||||
white-space:pre-wrap;
|
||||
@@ -339,21 +332,28 @@ a:not(.btn):not(.noeffect):after {
|
||||
transform: rotateY( 180deg );
|
||||
}
|
||||
|
||||
/*** colors from http://clrs.cc/ ***/
|
||||
.navy{background-color:#001f3f!important;color:white}.blue{background-color:#0074d9!important;color:white}.aqua{background-color:#7fdbff!important;color:black}.teal{background-color:#39cccc!important;color:white}.olive{background-color:#3d9970!important;color:white}.green{background-color:#2ecc40!important;color:white}.aquamarine{background-color:#26a69a!important;color:white}.lime{background-color:#01ff70!important;color:black}.yellow{background-color:#ffdc00!important;color:black}.orange{background-color:#ff851b!important;color:white}.red{background-color:#cc1f00!important;color:white}.fuchsia{background-color:#f012be!important;color:white}.pink{background-color:#ee6e73!important;color:white}.purple{background-color:#b10dc9!important;color:white}.maroon{background-color:#85144b!important;color:white}.white{background-color:#fff!important;color:black;-webkit-box-shadow:inset 0px 0px 0px 1px #ddd;-moz-box-shadow:inset 0px 0px 0px 1px #ddd;box-shadow:inset 0px 0px 0px 1px #ddd}.gray{background-color:#aaa!important;color:white}.silver{background-color:#f1f1f1!important;color:black}.black{background-color:#000!important;color:white}.glass{background:rgba(255,255,255,0.5)!important;color:black}
|
||||
|
||||
/**** tags ****/
|
||||
.tags > span {
|
||||
.tags > span, .tags > span.off:hover {
|
||||
height: 30px;
|
||||
padding: 4px 9px;
|
||||
text-decoration: none;
|
||||
margin: 0 5px 30px 0 !important;
|
||||
white-space: nowrap;
|
||||
color: white;
|
||||
background-color: #26a69a;
|
||||
border-radius: 5px;
|
||||
font-size:12px;
|
||||
margin: 2px 5px 2px 0;
|
||||
display: inline-block;
|
||||
line-height: 32px;
|
||||
}
|
||||
.tags.dismissible > span:not(.off):hover {
|
||||
background-color: #ccc !important;
|
||||
}
|
||||
.tags.dismissible > span:not(.off):after {
|
||||
content: " \f00d";
|
||||
font-family: FontAwesome;
|
||||
}
|
||||
.tags > span.off {
|
||||
background-color: #ccc;
|
||||
}
|
||||
.tags.dismissible > span:hover {opacity: 0.5}
|
||||
.tags.dismissible > span:not(.off):after {content:" ✕"}
|
||||
.tags > span.off {background-color: #ccc}
|
||||
.tags.dismissible > span.off:hover {background-color:#26a69a}
|
||||
|
||||
/*** colors from http://clrs.cc/ ***/
|
||||
.navy{background-color:#001f3f;color:white}.blue{background-color:#0074d9;color:white}.aqua{background-color:#7fdbff;color:#111111}.teal{background-color:#39cccc;color:white}.olive{background-color:#3d9970;color:white}.green{background-color:#2ecc40;color:white}.aquamarine{background-color:#26a69a;color:white}.lime{background-color:#01ff70;color:#111111}.yellow{background-color:#ffdc00;color:#111111}.orange{background-color:#ff851b;color:white}.red{background-color:#cc1f00;color:white}.fuchsia{background-color:#f012be;color:white}.pink{background-color:#ee6e73;color:white}.purple{background-color:#b10dc9;color:white}.maroon{background-color:#85144b;color:white}.white{background-color:#fff;color:#111111;-webkit-box-shadow:inset 0px 0px 0px 1px #ddd;-moz-box-shadow:inset 0px 0px 0px 1px #ddd;box-shadow:inset 0px 0px 0px 1px #ddd}.gray{background-color:#aaa;color:white}.silver{background-color:#f1f1f1;color:#111111}.black{background-color:#111111;color:white}.glass{background:rgba(255,255,255,0.5);color:#111111}
|
||||
|
||||
+5
-5
File diff suppressed because one or more lines are too long
@@ -1,10 +1,11 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
<center>
|
||||
<iframe src="//player.vimeo.com/hubnut/album/3016728?color=ff6600&background=ffffff&slideshow=1&video_title=1&video_byline=1" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
||||
</center>
|
||||
|
||||
<div>
|
||||
{{=get_content('main')}}
|
||||
<center>
|
||||
<iframe src="//player.vimeo.com/hubnut/album/3016728?color=ff6600&background=ffffff&slideshow=1&video_title=1&video_byline=1" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
||||
</center>
|
||||
{{=get_content('official')}}
|
||||
{{=get_content('community')}}
|
||||
{{=get_content('more')}}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="btn btn180 rounded green" href="http://www.web2py.com/examples/static/web2py_win.zip">For Windows</a>
|
||||
<a class="btn btn180 rounded red" href="http://www.web2py.com/examples/static/web2py_win.zip">For Windows</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn180 rounded yellow" href="http://www.web2py.com/examples/static/nightly/web2py_win.zip">For Windows</a>
|
||||
@@ -28,7 +28,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="btn btn180 rounded green" href="http://www.web2py.com/examples/static/web2py_osx.zip">For Mac</a>
|
||||
<a class="btn btn180 rounded red" href="http://www.web2py.com/examples/static/web2py_osx.zip">For Mac</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn180 rounded yellow" href="http://www.web2py.com/examples/static/nightly/web2py_osx.zip">For Mac</a>
|
||||
@@ -37,7 +37,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="btn btn180 rounded green" href="http://www.web2py.com/examples/static/web2py_src.zip">Source Code</a>
|
||||
<a class="btn btn180 rounded red" href="http://www.web2py.com/examples/static/web2py_src.zip">Source Code</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn180 rounded yellow" href="http://www.web2py.com/examples/static/nightly/web2py_src.zip">Source Code</a>
|
||||
@@ -48,7 +48,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="btn btn180 rounded green" href="https://dl.dropbox.com/u/18065445/web2py/web2py_manual_5th.pdf">Manual</a>
|
||||
<a class="btn btn180 rounded red" href="https://dl.dropbox.com/u/18065445/web2py/web2py_manual_5th.pdf">Manual</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn180 rounded" href="https://github.com/web2py/web2py/releases">Change Log</a>
|
||||
@@ -69,9 +69,9 @@
|
||||
<h3>Instructions</h3>
|
||||
<p>After download, unzip it and click on web2py.exe (windows) or web2py.app (osx).
|
||||
To run from source, type:</p>
|
||||
{{=CODE("python2.7 web2py.py", language=None, counter='>', _class='boxCode')}}
|
||||
{{=CODE("python2.7 web2py.py",language=None,counter='>',_class='boxCode')}}
|
||||
<p>or for more info type:</p>
|
||||
{{=CODE("python2.7 web2py.py -h", language=None, counter='>', _class='boxCode')}}
|
||||
{{=CODE("python2.7 web2py.py -h",language=None,counter='>',_class='boxCode')}}
|
||||
|
||||
|
||||
<h3>Caveats</h3>
|
||||
@@ -84,7 +84,7 @@
|
||||
<p>Applications built with web2py can be released under any license the author wishes as long they do not contain web2py code. They can link unmodified web2py libraries and they can be distributed with official web2py binaries. In particular web2py applications can be distributed in closed source. The admin interface provides a button to byte-code compile.</p>
|
||||
<p>It is fine to distribute web2py (source or compiled) with your applications as long as you make it clear in the license where your application ends and web2py starts.</p>
|
||||
<p>web2py is copyrighted by Massimo Di Pierro. The web2py trademark is owned by Massimo Di Pierro.</p>
|
||||
<a class="btn btn-small rounded" href="{{=URL('license')}}">read more</a>
|
||||
<a class="btn btn-small" href="{{=URL('license')}}">read more</a>
|
||||
|
||||
<h3>Artwork</h3>
|
||||
<center>
|
||||
|
||||
@@ -94,6 +94,7 @@ def status():
|
||||
return dict(toobar=response.toolbar())
|
||||
""".strip(),language='web2py',link=URL('global','vars'),_class='boxCode')}}
|
||||
<p>Here we are showing the request, session and response objects using the generic.html template.
|
||||
<br/>Try it here: <a class="btn" href="/{{=request.application}}/simple_examples/status">status</a></p>
|
||||
|
||||
<h3>Example {{=c}}{{c+=1}}</h3><b>In controller: simple_examples.py</b>
|
||||
{{=CODE("""
|
||||
@@ -277,7 +278,7 @@ def xml():
|
||||
<h3>Example {{=c}}{{c+=1}}</h3><b>In controller: template_examples.py </b>
|
||||
{{=CODE("""
|
||||
def beautify():
|
||||
dict(message=BEAUTIFY(dict(a=1,b=[2,3,dict(hello='world')])))
|
||||
return dict(message=BEAUTIFY(request))
|
||||
""".strip(),language='web2py',link=URL('global','vars'),_class='boxCode')}}<b>and view: template_examples/beautify.html</b>
|
||||
{{=CODE(open(os.path.join(request.folder,'views/template_examples/beautify.html'),'r').read(),language='html',link=URL('global','vars'),_class='boxCode')}}
|
||||
<p>You can use BEAUTIFY to turn lists and dictionaries into organized HTML.
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
<div class="container">
|
||||
<div class="twothirds">
|
||||
<div class="padded">
|
||||
<h3><img src="{{=URL('static/images', 'web2py_logo.png')}}"> Web Framework</h3>
|
||||
<h3>web2py<sup>TM</sup> Web Framework</h3>
|
||||
<p>Free open source full-stack framework for rapid development of fast, scalable, <a href="http://www.web2py.com/book/default/chapter/01#Security" target="_blank">secure</a> and portable database-driven web-based applications. Written and programmable in <a href="http://www.python.org" target="_blank">Python</a>.</p>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<a class="noeffect" href="http://web2py.com/book">
|
||||
<a href="http://web2py.com/book">
|
||||
<img src="{{=URL('static','images/book-5th.png')}}" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="noeffect" href="https://vimeo.com/album/3016728">
|
||||
<a href="https://vimeo.com/album/3016728">
|
||||
<img src="{{=URL('static','images/videos.png')}}" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="noeffect" href="http://link.packtpub.com/SUlnrN">
|
||||
<a href="http://link.packtpub.com/SUlnrN">
|
||||
<img src="{{=URL('static','images/book-recipes.png')}}" />
|
||||
</a>
|
||||
</td>
|
||||
@@ -29,15 +29,12 @@
|
||||
</div>
|
||||
<div class="third">
|
||||
<div class="padded center">
|
||||
<a class="noeffect" href="http://www.infoworld.com/slideshow/24605/infoworlds-2012-technology-of-the-year-award-winners-183313#slide23">
|
||||
<img class="spaced-vertical" src="{{=URL('static','images/infoworld2012.jpeg')}}">
|
||||
<a href="http://www.infoworld.com/slideshow/24605/infoworlds-2012-technology-of-the-year-award-winners-183313#slide23">
|
||||
<img src="{{=URL('static','images/infoworld2012.jpeg')}}">
|
||||
</a>
|
||||
<a class="btn rounded red fill" href="{{=URL('download')}}">
|
||||
Download Now
|
||||
</a>
|
||||
<a class="btn rounded red fill" href="{{=URL('examples')}}">
|
||||
Quick Examples
|
||||
</a>
|
||||
<a class="btn rounded red fill" href="https://www.pythonanywhere.com/try-web2py">
|
||||
Try it now online
|
||||
</a>
|
||||
@@ -63,7 +60,12 @@
|
||||
<div class="third">
|
||||
<div class="padded">
|
||||
<h5><a href="{{=URL('documentation')}}">Extensive Docs</a></h5>
|
||||
<p>Start with some <a href="{{=URL('examples')}}">quick examples</a>, then read the <a href="http://www.web2py.com/book" target="_blank">manual</a> and the <a href="http://web2py.readthedocs.org/en/latest/" target="_blank">Sphinx docs</a>, watch <a href="http://vimeo.com/album/178500" target="_blank">videos</a>, and join a <a href="{{=URL('default', 'usergroups')}}">user group</a> for discussion. Take advantage of the <a href="http://www.web2py.com/layouts" target="_blank">layouts</a>, <a href="http://www.web2pyslices.com/home?content_type=Package" target="_blank">plugins</a>, <a href="http://www.web2py.com/appliances" target="_blank">appliances</a>, and <a href="http://web2pyslices.com" target="_blank">recipes</a>.</p>
|
||||
<p>Start with some <a href="{{=URL('examples')}}">quick examples</a>, then read the <a href="http://www.web2py.com/book" target="_blank">manual</a> and the <a href="http://web2py.readthedocs.org/en/latest/" target="_blank">Sphinx docs</a>, watch <a href="http://vimeo.com/album/178500" target="_blank">videos</a>, and join a <a href="{{=URL('default', 'usergroups')}}">user group</a> for discussion. Take advantage of the <a href="http://www.web2py.com/layouts" target="_blank">layouts</a>, <a href="http://dev.s-cubism.com/web2py_plugins" target="_blank">plugins</a>, <a href="http://www.web2py.com/appliances" target="_blank">appliances</a>, and <a href="http://web2pyslices.com" target="_blank">recipes</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="fill padded">
|
||||
<img class="scale-with-grid centered" src="/examples/static/images/shadow-bottom.png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<li><a target="_blank" href="http://www.albendas.com">Albendas</a> (Spain)</li>
|
||||
<li><a target="_blank" href="http://www.appliedobjects.com">Applied Objects</a> (New Zealand)</li>
|
||||
<li><a target="_blank" href="http://www.sistemasagiles.com.ar/">Sistemas Ágiles</a> ("Agile Systems") (Argentina)</li>
|
||||
<li><a target="_blank" href="http://www.definescope.com/en/services/consulting/">DefineScope</a> (Portugal)</li>
|
||||
<li><a target="_blank" href="http://www.tasko.it/">Tasko</a> (Italy)</li>
|
||||
<li><a target="_blank" href="http://www.geekondemand.it/"> GeekOnDemand</a> (Italy)</li>
|
||||
<li><a target="_blank" href="http://stifix.com"> Stifix</a> (Indonesia)</li>
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
</li><li>Keith Yang (openid)
|
||||
</li><li><a href="http://dev.s-cubism.com/web2py_plugins">Kenji Hosoda</a> (plugins)
|
||||
</li><li>Kyle Smith (javascript)
|
||||
</li><li><a href="https://github.com/leonelcamara">Leonel Câmara</a>
|
||||
</li><li><a href="http://blog.donews.com/limodou/">Limodou</a> (winservice)
|
||||
</li><li><a href="https://github.com/lucasdavila">Lucas D'Ávila</a>
|
||||
</li><li>Marc Abramowitz (tests and travis continuous integration)
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<link href="{{=URL('static','css/stupid.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{=URL('static','css/calendar.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{=URL('static','css/web2py.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{=URL('static','css/stupid.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{=URL('static','css/examples.css')}}" rel="stylesheet" type="text/css"/>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<link rel="shortcut icon" href="{{=URL('static','images/favicon.ico')}}" type="image/x-icon">
|
||||
<link rel="apple-touch-icon" href="{{=URL('static','images/favicon.png')}}">
|
||||
<style>
|
||||
th {color: black}
|
||||
tbody tr:hover {background-color:transparent}
|
||||
tbody tr {border-bottom: none}
|
||||
p {text-align: left}
|
||||
pre {background-color: black!important;border-radius:5px; color:white; padding:10px}
|
||||
a.btn.btn180 {padding:20px; font-size:1.2em; width:200px!important}
|
||||
</style>
|
||||
{{
|
||||
left_sidebar_enabled = globals().get('left_sidebar_enabled', False)
|
||||
right_sidebar_enabled = globals().get('right_sidebar_enabled', False)
|
||||
@@ -24,7 +28,7 @@
|
||||
<header class="black padded">
|
||||
<div class="container middle max900">
|
||||
<div class="fill middle">
|
||||
<label class="ham" for="menu"><i class="fa fa-bars padded"></i></label>
|
||||
<label class="ham padded fa fa-bars" for="menu"></label>
|
||||
<div class="burger accordion">
|
||||
<input type="checkbox" id="menu"/>
|
||||
{{=MENU(response.menu,_class='menu')}}
|
||||
@@ -47,10 +51,6 @@
|
||||
<div class="quarter padded">{{block right_sidebar}}{{end}}</div>
|
||||
{{pass}}
|
||||
</div>
|
||||
<div class="silver center padded">
|
||||
<a class="fa fa-twitter" href="https://twitter.com/web2py/"></a>
|
||||
<a class="fa fa-facebook" href="https://www.facebook.com/web2py/"></a>
|
||||
</div>
|
||||
</main>
|
||||
<footer class="black">
|
||||
<div class="container padded max900">
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
{{=toolbar}}
|
||||
@@ -1,13 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# this file is released under public domain and you can use without limitations
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# This is a sample controller
|
||||
# - index is the default action of any application
|
||||
# - user is required for authentication and authorization
|
||||
# - download is for downloading files uploaded in the db (does streaming)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
#########################################################################
|
||||
## This is a sample controller
|
||||
## - index is the default action of any application
|
||||
## - user is required for authentication and authorization
|
||||
## - download is for downloading files uploaded in the db (does streaming)
|
||||
#########################################################################
|
||||
|
||||
def index():
|
||||
"""
|
||||
|
||||
@@ -1,491 +1,480 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'!langcode!': 'cs-cz',
|
||||
'!langname!': 'čeština',
|
||||
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': 'Kolonka "Upravit" je nepovinný výraz, například "pole1=\'nováhodnota\'". Výsledky databázového JOINu nemůžete mazat ani upravovat.',
|
||||
'"User Exception" debug mode. An error ticket could be issued!': '"User Exception" debug mode. An error ticket could be issued!',
|
||||
'%%{Row} in Table': '%%{řádek} v tabulce',
|
||||
'%%{Row} selected': 'označených %%{řádek}',
|
||||
'%s %%{row} deleted': '%s smazaných %%{záznam}',
|
||||
'%s %%{row} updated': '%s upravených %%{záznam}',
|
||||
'%s selected': '%s označených',
|
||||
'%Y-%m-%d': '%d.%m.%Y',
|
||||
'%Y-%m-%d %H:%M:%S': '%d.%m.%Y %H:%M:%S',
|
||||
'(requires internet access)': '(vyžaduje připojení k internetu)',
|
||||
'(requires internet access, experimental)': '(vyžaduje internetové připojení, experimentální)',
|
||||
'(something like "it-it")': '(například "cs-cz")',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '@markmin\x01(soubor **gluon/contrib/plural_rules/%s.py** nenalezen)',
|
||||
'@markmin\x01An error occured, please [[reload %s]] the page': '@markmin\x01Došlo k chybě, prosím [[obnovte stránku %s]]',
|
||||
'@markmin\x01Searching: **%s** %%{file}': '@markmin\x01Hledání: **%s** %%{soubor}',
|
||||
'About': 'O programu',
|
||||
'About application': 'O aplikaci',
|
||||
'Access Control': 'Řízení přístupu',
|
||||
'Add breakpoint': 'Přidat bod přerušení',
|
||||
'Additional code for your application': 'Další kód pro Vaši aplikaci',
|
||||
'admin': 'admin',
|
||||
'Admin design page': 'Admin design page',
|
||||
'Admin language': 'jazyk rozhraní',
|
||||
'Administrative interface': 'pro administrátorské rozhraní klikněte sem',
|
||||
'Administrative Interface': 'Administrátorské rozhraní',
|
||||
'administrative interface': 'rozhraní pro správu',
|
||||
'Administrator Password:': 'Administrátorské heslo:',
|
||||
'Ajax Recipes': 'Recepty s ajaxem',
|
||||
'An error occured, please %s the page': 'Došlo k chybě, prosím %s stránku',
|
||||
'and rename it:': 'a přejmenovat na:',
|
||||
'appadmin': 'appadmin',
|
||||
'appadmin is disabled because insecure channel': 'appadmin je zakázaná bez zabezpečeného spojení',
|
||||
'Application': 'Aplikace',
|
||||
'application "%s" uninstalled': 'application "%s" odinstalována',
|
||||
'application compiled': 'aplikace zkompilována',
|
||||
'Application name:': 'Název aplikace:',
|
||||
'are not used': 'nepoužita',
|
||||
'are not used yet': 'ještě nepoužita',
|
||||
'Are you sure you want to delete this object?': 'Opravdu chcete odstranit tento objekt?',
|
||||
'Are you sure you want to uninstall application "%s"?': 'Opravdu chcete odinstalovat aplikaci "%s"?',
|
||||
'arguments': 'argumenty',
|
||||
'at char %s': 'na pozici znaku %s',
|
||||
'at line %s': 'na řádku %s',
|
||||
'ATTENTION:': 'POZOR:',
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.',
|
||||
'Available Databases and Tables': 'Dostupné databáze a tabulky',
|
||||
'back': 'zpět',
|
||||
'Back to wizard': 'Zpátky do průvodce',
|
||||
'Basics': 'Základy',
|
||||
'Begin': 'Začít',
|
||||
'breakpoint': 'bod přerušení',
|
||||
'Breakpoints': 'Body přerušení',
|
||||
'breakpoints': 'body přerušení',
|
||||
'Buy this book': 'Koupit Web2py knihu',
|
||||
"Buy web2py's book": 'Koupit Web2py knihu',
|
||||
'Cache': 'Cache',
|
||||
'cache': 'cache',
|
||||
'Cache Keys': 'Klíče cache',
|
||||
'cache, errors and sessions cleaned': 'cache, chyby a relace byly pročištěny',
|
||||
'can be a git repo': 'může to být git repo',
|
||||
'Cancel': 'Storno',
|
||||
'Cannot be empty': 'Nemůže být prázdné',
|
||||
'Change Admin Password': 'Změnit heslo pro správu',
|
||||
'Change admin password': 'Změnit heslo pro správu aplikací',
|
||||
'Change password': 'Změna hesla',
|
||||
'check all': 'vše označit',
|
||||
'Check for upgrades': 'Zkusit aktualizovat',
|
||||
'Check to delete': 'Označit ke smazání',
|
||||
'Check to delete:': 'Označit ke smazání:',
|
||||
'Checking for upgrades...': 'Zjišťuji, zda jsou k dispozici aktualizace...',
|
||||
'Clean': 'Pročistit',
|
||||
'Clear CACHE?': 'Vymazat CACHE?',
|
||||
'Clear DISK': 'Vymazat DISK',
|
||||
'Clear RAM': 'Vymazat RAM',
|
||||
'Click row to expand traceback': 'Pro rozbalení stopy, klikněte na řádek',
|
||||
'Click row to view a ticket': 'Pro zobrazení chyby (ticketu), klikněte na řádku...',
|
||||
'Client IP': 'IP adresa klienta',
|
||||
'code': 'kód',
|
||||
'Code listing': 'Výpis kódu',
|
||||
'collapse/expand all': 'vše sbalit/rozbalit',
|
||||
'Community': 'Komunita',
|
||||
'Compile': 'Zkompilovat',
|
||||
'compiled application removed': 'zkompilovaná aplikace smazána',
|
||||
'Components and Plugins': 'Komponenty a zásuvné moduly',
|
||||
'Condition': 'Podmínka',
|
||||
'Config.ini': 'Config.ini',
|
||||
'continue': 'pokračovat',
|
||||
'Controller': 'Kontrolér (Controller)',
|
||||
'Controllers': 'Kontroléry',
|
||||
'controllers': 'kontroléry',
|
||||
'Copyright': 'Copyright',
|
||||
'Count': 'Počet',
|
||||
'Create': 'Vytvořit',
|
||||
'create file with filename:': 'vytvořit soubor s názvem:',
|
||||
'created by': 'vytvořil',
|
||||
'Created By': 'Vytvořeno - kým',
|
||||
'Created On': 'Vytvořeno - kdy',
|
||||
'crontab': 'crontab',
|
||||
'Current request': 'Aktuální požadavek',
|
||||
'Current response': 'Aktuální odpověď',
|
||||
'Current session': 'Aktuální relace',
|
||||
'currently running': 'právě běží',
|
||||
'currently saved or': 'uloženo nebo',
|
||||
'customize me!': 'upravte mě!',
|
||||
'data uploaded': 'data nahrána',
|
||||
'Database': 'Rozhraní databáze',
|
||||
'Database %s select': 'databáze %s výběr',
|
||||
'Database administration': 'Administrace databáze',
|
||||
'database administration': 'správa databáze',
|
||||
'Date and Time': 'Datum a čas',
|
||||
'day': 'den',
|
||||
'db': 'db',
|
||||
'DB Model': 'Databázový model',
|
||||
'Debug': 'Ladění',
|
||||
'defines tables': 'definuje tabulky',
|
||||
'Delete': 'Smazat',
|
||||
'delete': 'smazat',
|
||||
'delete all checked': 'smazat vše označené',
|
||||
'delete plugin': 'zrušit plugin',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Smazat tento soubor (budete požádán o potvrzení mazání)',
|
||||
'Delete:': 'Smazat:',
|
||||
'deleted after first hit': 'smazat po prvním dosažení',
|
||||
'Demo': 'Demo',
|
||||
'Deploy': 'Nahrát',
|
||||
'Deploy on Google App Engine': 'Nahrát na Google App Engine',
|
||||
'Deploy to OpenShift': 'Nahrát na OpenShift',
|
||||
'Deployment Recipes': 'Postupy pro deployment',
|
||||
'Description': 'Popis',
|
||||
'design': 'návrh',
|
||||
'Design': 'Design',
|
||||
'Detailed traceback description': 'Podrobný výpis prostředí',
|
||||
'details': 'podrobnosti',
|
||||
'direction: ltr': 'směr: ltr',
|
||||
'Disable': 'Zablokovat',
|
||||
'DISK': 'DISK',
|
||||
'Disk Cache Keys': 'Klíče diskové cache',
|
||||
'Disk Cleared': 'Disk smazán',
|
||||
'docs': 'dokumentace',
|
||||
'Documentation': 'Dokumentace',
|
||||
"Don't know what to do?": 'Kde najdu další informace ?',
|
||||
'done!': 'hotovo!',
|
||||
'Download': 'Stáhnout',
|
||||
'download layouts': 'stáhnout moduly rozvržení stránky',
|
||||
'download plugins': 'stáhnout zásuvné moduly',
|
||||
'E-mail': 'E-mail',
|
||||
'Edit': 'Upravit',
|
||||
'edit all': 'editovat vše',
|
||||
'Edit application': 'Správa aplikace',
|
||||
'edit controller': 'editovat controller',
|
||||
'Edit current record': 'Upravit aktuální záznam',
|
||||
'Edit Profile': 'Upravit profil',
|
||||
'edit views:': 'upravit pohled:',
|
||||
'Editing file "%s"': 'Úprava souboru "%s"',
|
||||
'Editing Language file': 'Úprava jazykového souboru',
|
||||
'Editing Plural Forms File': 'Editování souboru množných čísel',
|
||||
'Email and SMS': 'Email a SMS',
|
||||
'Enable': 'Odblokovat',
|
||||
'enter a number between %(min)g and %(max)g': 'zadejte číslo mezi %(min)g a %(max)g',
|
||||
'Enter an integer between %(min)g and %(max)g': 'Enter an integer between %(min)g and %(max)g',
|
||||
'enter an integer between %(min)g and %(max)g': 'zadejte celé číslo mezi %(min)g a %(max)g',
|
||||
'Error': 'Chyba',
|
||||
'Error logs for "%(app)s"': 'Seznam výskytu chyb pro aplikaci "%(app)s"',
|
||||
'Error snapshot': 'Snapshot chyby',
|
||||
'Error ticket': 'Ticket chyby',
|
||||
'Errors': 'Chyby',
|
||||
'Exception %(extype)s: %(exvalue)s': 'Výjimka %(extype)s: %(exvalue)s',
|
||||
'Exception %s': 'Výjimka %s',
|
||||
'Exception instance attributes': 'Prvky instance výjimky',
|
||||
'Expand Abbreviation': 'Expandovat zkratku',
|
||||
'export as csv file': 'exportovat do .csv souboru',
|
||||
'exposes': 'vystavuje',
|
||||
'exposes:': 'vystavuje funkce:',
|
||||
'extends': 'rozšiřuje',
|
||||
'failed to compile file because:': 'soubor se nepodařilo zkompilovat, protože:',
|
||||
'FAQ': 'Často kladené dotazy',
|
||||
'File': 'Soubor',
|
||||
'file': 'soubor',
|
||||
'file "%(filename)s" created': 'soubor "%(filename)s" byl vytvořen',
|
||||
'file saved on %(time)s': 'soubor uložen %(time)s',
|
||||
'file saved on %s': 'soubor uložen %s',
|
||||
'Filename': 'Název souboru',
|
||||
'filter': 'filtr',
|
||||
'Find Next': 'Najít další',
|
||||
'Find Previous': 'Najít předchozí',
|
||||
'First name': 'Křestní jméno',
|
||||
'Forgot username?': 'Zapomněl jste svoje přihlašovací jméno?',
|
||||
'forgot username?': 'zapomněl jste svoje přihlašovací jméno?',
|
||||
'Forms and Validators': 'Formuláře a validátory',
|
||||
'Frames': 'Framy',
|
||||
'Free Applications': 'Aplikace zdarma',
|
||||
'Functions with no doctests will result in [passed] tests.': 'Functions with no doctests will result in [passed] tests.',
|
||||
'Generate': 'Vytvořit',
|
||||
'Get from URL:': 'Stáhnout z internetu:',
|
||||
'Git Pull': 'Git Pull',
|
||||
'Git Push': 'Git Push',
|
||||
'Globals##debug': 'Globální proměnné',
|
||||
'go!': 'OK!',
|
||||
'Goto': 'Přejít na',
|
||||
'graph model': 'grafický model',
|
||||
'Group %(group_id)s created': 'Skupina %(group_id)s vytvořena',
|
||||
'Group ID': 'ID skupiny',
|
||||
'Groups': 'Skupiny',
|
||||
'Hello World': 'Ahoj všichni',
|
||||
'Help': 'Nápověda',
|
||||
'Helping web2py': 'Podpořte Web2py',
|
||||
'Hide/Show Translated strings': 'Skrýt/Zobrazit přeložené texty',
|
||||
'Hits': 'Kolikrát dosaženo',
|
||||
'Home': 'Domovská stránka',
|
||||
'honored only if the expression evaluates to true': 'brát v potaz jen když se tato podmínka vyhodnotí kladně',
|
||||
'How did you get here?': 'Jak se Ti tato stránka vlastně zobrazila?',
|
||||
'If start the upgrade, be patient, it may take a while to download': 'If start the upgrade, be patient, it may take a while to download',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\r\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
|
||||
'import': 'import',
|
||||
'Import/Export': 'Import/Export',
|
||||
'includes': 'zahrnuje',
|
||||
'Index': 'Index',
|
||||
'insert new': 'vložit nový záznam ',
|
||||
'insert new %s': 'vložit nový záznam %s',
|
||||
'inspect attributes': 'prohlédnout atributy',
|
||||
'Install': 'Instalovat',
|
||||
'Installed applications': 'Nainstalované aplikace',
|
||||
'Interaction at %s line %s': 'Interakce v %s, na řádce %s',
|
||||
'Interactive console': 'Interaktivní příkazová řádka',
|
||||
'Internal State': 'Vnitřní stav',
|
||||
'Introduction': 'Úvod',
|
||||
'Invalid email': 'Neplatný email',
|
||||
'Invalid password': 'Nesprávné heslo',
|
||||
'invalid password.': 'neplatné heslo',
|
||||
'Invalid Query': 'Neplatný dotaz',
|
||||
'invalid request': 'Neplatný požadavek',
|
||||
'Is Active': 'Je aktivní',
|
||||
'It is %s %%{day} today.': 'Dnes je to %s %%{den}.',
|
||||
'Key': 'Klíč',
|
||||
'Key bindings': 'Vazby klíčů',
|
||||
'Key bindings for ZenCoding Plugin': 'Key bindings pro ZenCoding Plugin',
|
||||
'languages': 'jazyky',
|
||||
'Languages': 'Jazyky',
|
||||
'Last name': 'Příjmení',
|
||||
'Last saved on:': 'Naposledy uloženo:',
|
||||
'Layout': 'Rozvržení stránky (layout)',
|
||||
'Layout Plugins': 'Moduly rozvržení stránky (Layout Plugins)',
|
||||
'Layouts': 'Rozvržení stránek',
|
||||
'License for': 'Licence pro',
|
||||
'Line number': 'Číslo řádku',
|
||||
'LineNo': 'Č.řádku',
|
||||
'Live Chat': 'Online chat',
|
||||
'loading...': 'nahrávám...',
|
||||
'locals': 'locals',
|
||||
'Locals##debug': 'Lokální proměnné',
|
||||
'Log In': 'Přihlásit se',
|
||||
'Logged in': 'Přihlášení proběhlo úspěšně',
|
||||
'Logged out': 'Odhlášení proběhlo úspěšně',
|
||||
'Login': 'Přihlásit se',
|
||||
'login': 'přihlásit se',
|
||||
'Login to the Administrative Interface': 'Přihlásit se do Správce aplikací',
|
||||
'logout': 'odhlásit se',
|
||||
'Logout': 'Odhlásit se',
|
||||
'Lost Password': 'Zapomněl jste heslo',
|
||||
'Lost password?': 'Zapomněl jste heslo?',
|
||||
'lost password?': 'zapomněl jste heslo?',
|
||||
'Manage': 'Spravovat',
|
||||
'Manage Cache': 'Spravovat cache',
|
||||
'Menu Model': 'Model rozbalovací nabídky',
|
||||
'Models': 'Modely',
|
||||
'models': 'modely',
|
||||
'Modified By': 'Změněno - kým',
|
||||
'Modified On': 'Změněno - kdy',
|
||||
'Modules': 'Moduly',
|
||||
'modules': 'moduly',
|
||||
'My Sites': 'Správa aplikací',
|
||||
'Name': 'Jméno',
|
||||
'new application "%s" created': 'nová aplikace "%s" vytvořena',
|
||||
'New application wizard': 'Nový průvodce aplikací',
|
||||
'New Application Wizard': 'Nový průvodce aplikací',
|
||||
'New password': 'Nové heslo',
|
||||
'New Record': 'Nový záznam',
|
||||
'new record inserted': 'nový záznam byl založen',
|
||||
'New simple application': 'Vytvořit novou aplikaci',
|
||||
'next': 'další',
|
||||
'next 100 rows': 'dalších 100 řádků',
|
||||
'No databases in this application': 'V této aplikaci nejsou žádné databáze',
|
||||
'No Interaction yet': 'Ještě žádná interakce nenastala',
|
||||
'No ticket_storage.txt found under /private folder': 'Soubor ticket_storage.txt v adresáři /private nenalezen',
|
||||
'Object or table name': 'Objekt či tabulka',
|
||||
'Old password': 'Původní heslo',
|
||||
'Online book': 'Online kniha',
|
||||
'online designer': 'online návrhář',
|
||||
'Online examples': 'Ukázka aplikace: web2py stránky',
|
||||
'Open new app in new window': 'Otevřít novou aplikaci v novém okně',
|
||||
'or alternatively': 'nebo případně',
|
||||
'Or Get from URL:': 'Nebo získat z URL adresy:',
|
||||
'or import from csv file': 'nebo importovat z .csv souboru',
|
||||
'Origin': 'Původ',
|
||||
'Original/Translation': 'Originál/Překlad',
|
||||
'Other Plugins': 'Ostatní moduly',
|
||||
'Other Recipes': 'Ostatní zásuvné moduly',
|
||||
'Overview': 'Přehled',
|
||||
'Overwrite installed app': 'Přepsat instalovanou aplikaci',
|
||||
'Pack all': 'Zabalit',
|
||||
'Pack compiled': 'Zabalit zkompilované',
|
||||
'pack plugin': 'pack (zabalit) plugin',
|
||||
'password': 'heslo',
|
||||
'Password': 'Heslo',
|
||||
"Password fields don't match": 'Hesla se neshodují',
|
||||
'Peeking at file': 'Sledování souboru',
|
||||
'Please': 'Prosím',
|
||||
'Plugin "%s" in application': 'Plugin "%s" v aplikaci',
|
||||
'plugins': 'zásuvné moduly',
|
||||
'Plugins': 'Zásuvné moduly',
|
||||
'Plural Form #%s': 'Množné číslo #%s',
|
||||
'Plural-Forms:': 'Množná čísla:',
|
||||
'Powered by': 'Používá technologii',
|
||||
'Preface': 'Předmluva',
|
||||
'previous 100 rows': 'předchozích 100 řádků',
|
||||
'Private files': 'Soukromé soubory',
|
||||
'private files': 'soukromé soubory',
|
||||
'profile': 'profil',
|
||||
'Project Progress': 'Vývoj projektu',
|
||||
'Python': 'Python',
|
||||
'Query:': 'Dotaz:',
|
||||
'Quick Examples': 'Krátké příklady',
|
||||
'RAM': 'RAM',
|
||||
'RAM Cache Keys': 'Klíče RAM Cache',
|
||||
'Ram Cleared': 'RAM smazána',
|
||||
'Readme': 'Nápověda',
|
||||
'Recipes': 'Postupy jak na to',
|
||||
'Record': 'Záznam',
|
||||
'record does not exist': 'záznam neexistuje',
|
||||
'Record ID': 'ID záznamu',
|
||||
'Record id': 'id záznamu',
|
||||
'refresh': 'obnovte',
|
||||
'register': 'registrovat',
|
||||
'Register': 'Zaregistrovat se',
|
||||
'Registration identifier': 'Registrační identifikátor',
|
||||
'Registration key': 'Registrační klíč',
|
||||
'reload': 'reload',
|
||||
'Reload routes': 'Znovu nahrát cesty',
|
||||
'Remember me (for 30 days)': 'Zapamatovat na 30 dní',
|
||||
'Remove compiled': 'Odstranit zkompilované',
|
||||
'Removed Breakpoint on %s at line %s': 'Bod přerušení smazán - soubor %s na řádce %s',
|
||||
'Replace': 'Zaměnit',
|
||||
'Replace All': 'Zaměnit vše',
|
||||
'request': 'request',
|
||||
'Reset Password key': 'Reset registračního klíče',
|
||||
'response': 'response',
|
||||
'restart': 'restart',
|
||||
'restore': 'obnovit',
|
||||
'Retrieve username': 'Získat přihlašovací jméno',
|
||||
'return': 'return',
|
||||
'revert': 'vrátit se k původnímu',
|
||||
'Role': 'Role',
|
||||
'Rows in Table': 'Záznamy v tabulce',
|
||||
'Rows selected': 'Záznamů zobrazeno',
|
||||
'rules are not defined': 'pravidla nejsou definována',
|
||||
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Spustí testy v tomto souboru (ke spuštění všech testů, použijte tlačítko 'test')",
|
||||
'Running on %s': 'Běží na %s',
|
||||
'Save': 'Uložit',
|
||||
'Save file:': 'Uložit soubor:',
|
||||
'Save via Ajax': 'Uložit pomocí Ajaxu',
|
||||
'Saved file hash:': 'hash uloženého souboru:',
|
||||
'Semantic': 'Modul semantic',
|
||||
'Services': 'Služby',
|
||||
'session': 'session',
|
||||
'session expired': 'vypršela session',
|
||||
'Set Breakpoint on %s at line %s: %s': 'Bod přerušení nastaven v souboru %s na řádce %s: %s',
|
||||
'shell': 'příkazová řádka',
|
||||
'Sign Up': 'Registrovat se',
|
||||
'Singular Form': 'Jednotné číslo',
|
||||
'Site': 'Správa aplikací',
|
||||
'Size of cache:': 'Velikost cache:',
|
||||
'skip to generate': 'přeskočit pro vytvoření',
|
||||
'Sorry, could not find mercurial installed': 'Bohužel mercurial není nainstalován.',
|
||||
'Start a new app': 'Vytvořit novou aplikaci',
|
||||
'Start searching': 'Začít hledání',
|
||||
'Start wizard': 'Spustit průvodce',
|
||||
'state': 'stav',
|
||||
'Static': 'Statické soubory',
|
||||
'static': 'statické soubory',
|
||||
'Static files': 'Statické soubory',
|
||||
'Statistics': 'Statistika',
|
||||
'Step': 'Krok',
|
||||
'step': 'krok',
|
||||
'stop': 'zastavit',
|
||||
'Stylesheet': 'CSS styly',
|
||||
'submit': 'odeslat',
|
||||
'Submit': 'Odeslat',
|
||||
'successful': 'úspěšně',
|
||||
'Support': 'Podpora',
|
||||
'Sure you want to delete this object?': 'Opravdu chcete smazat tento objekt?',
|
||||
'Table': 'tabulka',
|
||||
'Table name': 'Název tabulky',
|
||||
'Temporary': 'Dočasný',
|
||||
'test': 'test',
|
||||
'Testing application': 'Zkušební aplikace',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': '"Dotaz" je podmínka, například "db.tabulka1.pole1==\'hodnota\'". Podmínka "db.tabulka1.pole1==db.tabulka2.pole2" pak vytvoří SQL JOIN.',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'Logika aplikace: každá URL je mapována na funkci vystavovanou kontrolérem.',
|
||||
'The Core': 'Jádro (The Core)',
|
||||
'The data representation, define database tables and sets': 'Reprezentace dat: definovat tabulky databáze a záznamy',
|
||||
'The output of the file is a dictionary that was rendered by the view %s': 'Funkce vrátila dictionary (slovník) hodnot, a ty se vypsaly pomocí šablony %s.',
|
||||
'The presentations layer, views are also known as templates': 'Prezentační vrstva: pohledy či templaty (šablony)',
|
||||
'The Views': 'Pohledy (The Views)',
|
||||
'There are no controllers': 'Nejsou vytvořeny žádné controllery',
|
||||
'There are no modules': 'Nejsou přidány žádné moduly',
|
||||
'There are no plugins': 'Žádné pluginy nejsou instalovány.',
|
||||
'There are no private files': 'Žádné soukromé soubory neexistují.',
|
||||
'There are no static files': 'Nejsou přidány žádné statické soubory',
|
||||
'There are no translators, only default language is supported': 'There are no translators, only default language is supported',
|
||||
'There are no views': 'Nejsou vytvořeny žádné šablony (views)',
|
||||
'These files are not served, they are only available from within your app': 'Tyto soubory jsou klientům nepřístupné. K dispozici jsou pouze v rámci aplikace.',
|
||||
'These files are served without processing, your images go here': 'Tyto soubory jsou servírovány bez přídavné logiky, sem patří např. obrázky.',
|
||||
'This App': 'Tato aplikace',
|
||||
'This is a copy of the scaffolding application': 'Toto je kopie aplikace skelet.',
|
||||
'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk': 'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk',
|
||||
'This is the %(filename)s template': 'Toto je šablona %(filename)s',
|
||||
'this page to see if a breakpoint was hit and debug interaction is required.': 'tuto stránku, abyste uviděli, zda se dosáhlo bodu přerušení.',
|
||||
'Ticket': 'Tiket',
|
||||
'Ticket ID': 'ID tiketu',
|
||||
'Time in Cache (h:m:s)': 'Čas v Cache (h:m:s)',
|
||||
'Timestamp': 'Časové razítko',
|
||||
'to previous version.': 'k předchozí verzi.',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Zásuvný modul vytvoříte tak, že pojmenujete soubor/adresář plugin_[jméno modulu]',
|
||||
'To emulate a breakpoint programatically, write:': 'K nastavení bodu přerušení v kódu programu, napište:',
|
||||
'to use the debugger!': ', abyste mohli ladící program používat!',
|
||||
'toggle breakpoint': 'vyp./zap. bod přerušení',
|
||||
'Toggle Fullscreen': 'Na celou obrazovku a zpět',
|
||||
'too short': 'Příliš krátké',
|
||||
'Traceback': 'Hierarchie volání',
|
||||
'Translation strings for the application': 'Překlad textů pro aplikaci',
|
||||
'try something like': 'zkuste něco jako',
|
||||
'Try the mobile interface': 'Zkuste rozhraní pro mobilní zařízení',
|
||||
'try view': 'vyzkoušet šablonu (view)',
|
||||
'Twitter': 'Twitter',
|
||||
'Type python statement in here and hit Return (Enter) to execute it.': 'Type python statement in here and hit Return (Enter) to execute it.',
|
||||
'Type some Python code in here and hit Return (Enter) to execute it.': 'Type some Python code in here and hit Return (Enter) to execute it.',
|
||||
'Unable to check for upgrades': 'Nelze zjistit informaci o aktualizacích',
|
||||
'unable to parse csv file': 'csv soubor nedá sa zpracovat',
|
||||
'uncheck all': 'vše odznačit',
|
||||
'Uninstall': 'Odinstalovat',
|
||||
'update': 'aktualizovat',
|
||||
'update all languages': 'aktualizovat všechny jazyky',
|
||||
'Update:': 'Upravit:',
|
||||
'Upgrade': 'Upgrade',
|
||||
'upgrade now': 'upgradovat nyní',
|
||||
'upgrade now to %s': 'upgradovat nyní na %s',
|
||||
'upload': 'nahrát',
|
||||
'Upload': 'Upload (nahrát)',
|
||||
'Upload a package:': 'Nahrát balík:',
|
||||
'Upload and install packed application': 'Nahrát a instalovat zabalenou aplikaci',
|
||||
'upload file:': 'nahrát soubor:',
|
||||
'upload plugin file:': 'nahrát soubor modulu:',
|
||||
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Použijte (...)&(...) pro AND, (...)|(...) pro OR a ~(...) pro NOT pro sestavení složitějších dotazů.',
|
||||
'User %(id)s Logged-in': 'Uživatel %(id)s přihlášen',
|
||||
'User %(id)s Logged-out': 'Uživatel %(id)s odhlášen',
|
||||
'User %(id)s Password changed': 'Uživatel %(id)s změnil heslo',
|
||||
'User %(id)s Profile updated': 'Uživatel %(id)s upravil profil',
|
||||
'User %(id)s Registered': 'Uživatel %(id)s se zaregistroval',
|
||||
'User %(id)s Username retrieved': 'Uživatel %(id)s si nachal zaslat přihlašovací jméno',
|
||||
'User ID': 'ID uživatele',
|
||||
'Username': 'Přihlašovací jméno',
|
||||
'variables': 'proměnné',
|
||||
'Verify Password': 'Zopakujte heslo',
|
||||
'Version': 'Verze',
|
||||
'Version %s.%s.%s (%s) %s': 'Verze %s.%s.%s (%s) %s',
|
||||
'Versioning': 'Verzování',
|
||||
'Videos': 'Videa',
|
||||
'View': 'Pohled (View)',
|
||||
'Views': 'Pohledy',
|
||||
'views': 'pohledy',
|
||||
'Web Framework': 'Webový framework',
|
||||
'web2py is up to date': 'Máte aktuální verzi web2py.',
|
||||
'web2py online debugger': 'Ladící online web2py program',
|
||||
'web2py Recent Tweets': 'Štěbetání na Twitteru o web2py',
|
||||
'web2py upgrade': 'aktualizace Web2py',
|
||||
'web2py upgraded; please restart it': 'Web2py bylo aktualizováno; prosím restarujte jej',
|
||||
'Welcome': 'Vítejte',
|
||||
'Welcome to web2py': 'Vitejte ve Web2py aplikaci',
|
||||
'Welcome to web2py!': 'Vítejte ve Web2py aplikaci.',
|
||||
'Which called the function %s located in the file %s': 'Tím byla zavolána funkce %s ze souboru (kontroléru) %s.',
|
||||
'Working...': 'Pracuji...',
|
||||
'You are successfully running web2py': 'Spustil(a) jsi webový server a Web2py.',
|
||||
'You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button': 'Nastavovat a mazat body přerušení je též možno v rámci editování zdrojového souboru přes tlačítko Vyp./Zap. bod přerušení',
|
||||
'You can inspect variables using the console bellow': 'Níže pomocí příkazové řádky si můžete prohlédnout proměnné',
|
||||
'You can modify this application and adapt it to your needs': 'V ADMIN rozhraní můžeš Vytvořit novou aplikaci jako kopii ukázkové Welcome aplikace. A začít upravovat: modely, kontroléry, šablony pro URL adresy, které požaduješ.',
|
||||
'You need to set up and reach a': 'Je třeba nejprve nastavit a dojít až na',
|
||||
'You visited the url %s': 'Zadal jsi URL adresu %s.',
|
||||
'Your application will be blocked until you click an action button (next, step, continue, etc.)': 'Aplikace bude blokována než se klikne na jedno z tlačítek (další, krok, pokračovat, atd.)',
|
||||
}
|
||||
# coding: utf8
|
||||
{
|
||||
'!langcode!': 'cs-cz',
|
||||
'!langname!': 'čeština',
|
||||
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': 'Kolonka "Upravit" je nepovinný výraz, například "pole1=\'nováhodnota\'". Výsledky databázového JOINu nemůžete mazat ani upravovat.',
|
||||
'"User Exception" debug mode. An error ticket could be issued!': '"User Exception" debug mode. An error ticket could be issued!',
|
||||
'%%{Row} in Table': '%%{řádek} v tabulce',
|
||||
'%%{Row} selected': 'označených %%{řádek}',
|
||||
'%s %%{row} deleted': '%s smazaných %%{záznam}',
|
||||
'%s %%{row} updated': '%s upravených %%{záznam}',
|
||||
'%s selected': '%s označených',
|
||||
'%Y-%m-%d': '%d.%m.%Y',
|
||||
'%Y-%m-%d %H:%M:%S': '%d.%m.%Y %H:%M:%S',
|
||||
'(requires internet access)': '(vyžaduje připojení k internetu)',
|
||||
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
||||
'(something like "it-it")': '(například "cs-cs")',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(soubor **gluon/contrib/plural_rules/%s.py** nenalezen)',
|
||||
'@markmin\x01Searching: **%s** %%{file}': 'Hledání: **%s** %%{soubor}',
|
||||
'About': 'O programu',
|
||||
'About application': 'O aplikaci',
|
||||
'Access Control': 'Řízení přístupu',
|
||||
'Add breakpoint': 'Přidat bod přerušení',
|
||||
'Additional code for your application': 'Další kód pro Vaši aplikaci',
|
||||
'Admin design page': 'Admin design page',
|
||||
'Admin language': 'jazyk rozhraní',
|
||||
'Administrative interface': 'pro administrátorské rozhraní klikněte sem',
|
||||
'Administrative Interface': 'Administrátorské rozhraní',
|
||||
'administrative interface': 'rozhraní pro správu',
|
||||
'Administrator Password:': 'Administrátorské heslo:',
|
||||
'Ajax Recipes': 'Recepty s ajaxem',
|
||||
'An error occured, please %s the page': 'An error occured, please %s the page',
|
||||
'and rename it:': 'a přejmenovat na:',
|
||||
'appadmin': 'appadmin',
|
||||
'appadmin is disabled because insecure channel': 'appadmin je zakázaná bez zabezpečeného spojení',
|
||||
'Application': 'Application',
|
||||
'application "%s" uninstalled': 'application "%s" odinstalována',
|
||||
'application compiled': 'aplikace zkompilována',
|
||||
'Application name:': 'Název aplikace:',
|
||||
'are not used': 'nepoužita',
|
||||
'are not used yet': 'ještě nepoužita',
|
||||
'Are you sure you want to delete this object?': 'Opravdu chcete odstranit tento objekt?',
|
||||
'Are you sure you want to uninstall application "%s"?': 'Opravdu chcete odinstalovat aplikaci "%s"?',
|
||||
'arguments': 'arguments',
|
||||
'at char %s': 'at char %s',
|
||||
'at line %s': 'at line %s',
|
||||
'ATTENTION:': 'ATTENTION:',
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.',
|
||||
'Available Databases and Tables': 'Dostupné databáze a tabulky',
|
||||
'back': 'zpět',
|
||||
'Back to wizard': 'Back to wizard',
|
||||
'Basics': 'Basics',
|
||||
'Begin': 'Začít',
|
||||
'breakpoint': 'bod přerušení',
|
||||
'Breakpoints': 'Body přerušení',
|
||||
'breakpoints': 'body přerušení',
|
||||
'Buy this book': 'Koupit web2py knihu',
|
||||
'Cache': 'Cache',
|
||||
'cache': 'cache',
|
||||
'Cache Keys': 'Klíče cache',
|
||||
'cache, errors and sessions cleaned': 'cache, chyby a relace byly pročištěny',
|
||||
'can be a git repo': 'může to být git repo',
|
||||
'Cancel': 'Storno',
|
||||
'Cannot be empty': 'Nemůže být prázdné',
|
||||
'Change Admin Password': 'Změnit heslo pro správu',
|
||||
'Change admin password': 'Změnit heslo pro správu aplikací',
|
||||
'Change password': 'Změna hesla',
|
||||
'check all': 'vše označit',
|
||||
'Check for upgrades': 'Zkusit aktualizovat',
|
||||
'Check to delete': 'Označit ke smazání',
|
||||
'Check to delete:': 'Označit ke smazání:',
|
||||
'Checking for upgrades...': 'Zjišťuji, zda jsou k dispozici aktualizace...',
|
||||
'Clean': 'Pročistit',
|
||||
'Clear CACHE?': 'Vymazat CACHE?',
|
||||
'Clear DISK': 'Vymazat DISK',
|
||||
'Clear RAM': 'Vymazat RAM',
|
||||
'Click row to expand traceback': 'Pro rozbalení stopy, klikněte na řádek',
|
||||
'Click row to view a ticket': 'Pro zobrazení chyby (ticketu), klikněte na řádku...',
|
||||
'Client IP': 'IP adresa klienta',
|
||||
'code': 'code',
|
||||
'Code listing': 'Code listing',
|
||||
'collapse/expand all': 'vše sbalit/rozbalit',
|
||||
'Community': 'Komunita',
|
||||
'Compile': 'Zkompilovat',
|
||||
'compiled application removed': 'zkompilovaná aplikace smazána',
|
||||
'Components and Plugins': 'Komponenty a zásuvné moduly',
|
||||
'Condition': 'Podmínka',
|
||||
'continue': 'continue',
|
||||
'Controller': 'Kontrolér (Controller)',
|
||||
'Controllers': 'Kontroléry',
|
||||
'controllers': 'kontroléry',
|
||||
'Copyright': 'Copyright',
|
||||
'Count': 'Počet',
|
||||
'Create': 'Vytvořit',
|
||||
'create file with filename:': 'vytvořit soubor s názvem:',
|
||||
'created by': 'vytvořil',
|
||||
'Created By': 'Vytvořeno - kým',
|
||||
'Created On': 'Vytvořeno - kdy',
|
||||
'crontab': 'crontab',
|
||||
'Current request': 'Aktuální požadavek',
|
||||
'Current response': 'Aktuální odpověď',
|
||||
'Current session': 'Aktuální relace',
|
||||
'currently running': 'právě běží',
|
||||
'currently saved or': 'uloženo nebo',
|
||||
'customize me!': 'upravte mě!',
|
||||
'data uploaded': 'data nahrána',
|
||||
'Database': 'Rozhraní databáze',
|
||||
'Database %s select': 'databáze %s výběr',
|
||||
'Database administration': 'Database administration',
|
||||
'database administration': 'správa databáze',
|
||||
'Date and Time': 'Datum a čas',
|
||||
'day': 'den',
|
||||
'db': 'db',
|
||||
'DB Model': 'Databázový model',
|
||||
'Debug': 'Ladění',
|
||||
'defines tables': 'defines tables',
|
||||
'Delete': 'Smazat',
|
||||
'delete': 'smazat',
|
||||
'delete all checked': 'smazat vše označené',
|
||||
'delete plugin': 'delete plugin',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Smazat tento soubor (budete požádán o potvrzení mazání)',
|
||||
'Delete:': 'Smazat:',
|
||||
'deleted after first hit': 'smazat po prvním dosažení',
|
||||
'Demo': 'Demo',
|
||||
'Deploy': 'Nahrát',
|
||||
'Deploy on Google App Engine': 'Nahrát na Google App Engine',
|
||||
'Deploy to OpenShift': 'Nahrát na OpenShift',
|
||||
'Deployment Recipes': 'Postupy pro deployment',
|
||||
'Description': 'Popis',
|
||||
'design': 'návrh',
|
||||
'Detailed traceback description': 'Podrobný výpis prostředí',
|
||||
'details': 'podrobnosti',
|
||||
'direction: ltr': 'směr: ltr',
|
||||
'Disable': 'Zablokovat',
|
||||
'DISK': 'DISK',
|
||||
'Disk Cache Keys': 'Klíče diskové cache',
|
||||
'Disk Cleared': 'Disk smazán',
|
||||
'docs': 'dokumentace',
|
||||
'Documentation': 'Dokumentace',
|
||||
"Don't know what to do?": 'Nevíte kudy kam?',
|
||||
'done!': 'hotovo!',
|
||||
'Download': 'Stáhnout',
|
||||
'download layouts': 'stáhnout moduly rozvržení stránky',
|
||||
'download plugins': 'stáhnout zásuvné moduly',
|
||||
'E-mail': 'E-mail',
|
||||
'Edit': 'Upravit',
|
||||
'edit all': 'edit all',
|
||||
'Edit application': 'Správa aplikace',
|
||||
'edit controller': 'edit controller',
|
||||
'Edit current record': 'Upravit aktuální záznam',
|
||||
'Edit Profile': 'Upravit profil',
|
||||
'edit views:': 'upravit pohled:',
|
||||
'Editing file "%s"': 'Úprava souboru "%s"',
|
||||
'Editing Language file': 'Úprava jazykového souboru',
|
||||
'Editing Plural Forms File': 'Editing Plural Forms File',
|
||||
'Email and SMS': 'Email a SMS',
|
||||
'Enable': 'Odblokovat',
|
||||
'enter a number between %(min)g and %(max)g': 'zadejte číslo mezi %(min)g a %(max)g',
|
||||
'enter an integer between %(min)g and %(max)g': 'zadejte celé číslo mezi %(min)g a %(max)g',
|
||||
'Error': 'Chyba',
|
||||
'Error logs for "%(app)s"': 'Seznam výskytu chyb pro aplikaci "%(app)s"',
|
||||
'Error snapshot': 'Snapshot chyby',
|
||||
'Error ticket': 'Ticket chyby',
|
||||
'Errors': 'Chyby',
|
||||
'Exception %(extype)s: %(exvalue)s': 'Exception %(extype)s: %(exvalue)s',
|
||||
'Exception %s': 'Exception %s',
|
||||
'Exception instance attributes': 'Prvky instance výjimky',
|
||||
'Expand Abbreviation': 'Expand Abbreviation',
|
||||
'export as csv file': 'exportovat do .csv souboru',
|
||||
'exposes': 'vystavuje',
|
||||
'exposes:': 'vystavuje funkce:',
|
||||
'extends': 'rozšiřuje',
|
||||
'failed to compile file because:': 'soubor se nepodařilo zkompilovat, protože:',
|
||||
'FAQ': 'Často kladené dotazy',
|
||||
'File': 'Soubor',
|
||||
'file': 'soubor',
|
||||
'file "%(filename)s" created': 'file "%(filename)s" created',
|
||||
'file saved on %(time)s': 'soubor uložen %(time)s',
|
||||
'file saved on %s': 'soubor uložen %s',
|
||||
'Filename': 'Název souboru',
|
||||
'filter': 'filtr',
|
||||
'Find Next': 'Najít další',
|
||||
'Find Previous': 'Najít předchozí',
|
||||
'First name': 'Křestní jméno',
|
||||
'Forgot username?': 'Zapomněl jste svoje přihlašovací jméno?',
|
||||
'forgot username?': 'zapomněl jste svoje přihlašovací jméno?',
|
||||
'Forms and Validators': 'Formuláře a validátory',
|
||||
'Frames': 'Frames',
|
||||
'Free Applications': 'Aplikace zdarma',
|
||||
'Functions with no doctests will result in [passed] tests.': 'Functions with no doctests will result in [passed] tests.',
|
||||
'Generate': 'Vytvořit',
|
||||
'Get from URL:': 'Stáhnout z internetu:',
|
||||
'Git Pull': 'Git Pull',
|
||||
'Git Push': 'Git Push',
|
||||
'Globals##debug': 'Globální proměnné',
|
||||
'go!': 'OK!',
|
||||
'Goto': 'Goto',
|
||||
'graph model': 'graph model',
|
||||
'Group %(group_id)s created': 'Skupina %(group_id)s vytvořena',
|
||||
'Group ID': 'ID skupiny',
|
||||
'Groups': 'Skupiny',
|
||||
'Hello World': 'Ahoj světe',
|
||||
'Help': 'Nápověda',
|
||||
'Hide/Show Translated strings': 'Skrýt/Zobrazit přeložené texty',
|
||||
'Hits': 'Kolikrát dosaženo',
|
||||
'Home': 'Domovská stránka',
|
||||
'honored only if the expression evaluates to true': 'brát v potaz jen když se tato podmínka vyhodnotí kladně',
|
||||
'How did you get here?': 'Jak jste se sem vlastně dostal?',
|
||||
'If start the upgrade, be patient, it may take a while to download': 'If start the upgrade, be patient, it may take a while to download',
|
||||
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
|
||||
'import': 'import',
|
||||
'Import/Export': 'Import/Export',
|
||||
'includes': 'zahrnuje',
|
||||
'Index': 'Index',
|
||||
'insert new': 'vložit nový záznam ',
|
||||
'insert new %s': 'vložit nový záznam %s',
|
||||
'inspect attributes': 'inspect attributes',
|
||||
'Install': 'Instalovat',
|
||||
'Installed applications': 'Nainstalované aplikace',
|
||||
'Interaction at %s line %s': 'Interakce v %s, na řádce %s',
|
||||
'Interactive console': 'Interaktivní příkazová řádka',
|
||||
'Internal State': 'Vnitřní stav',
|
||||
'Introduction': 'Úvod',
|
||||
'Invalid email': 'Neplatný email',
|
||||
'Invalid password': 'Nesprávné heslo',
|
||||
'invalid password.': 'neplatné heslo',
|
||||
'Invalid Query': 'Neplatný dotaz',
|
||||
'invalid request': 'Neplatný požadavek',
|
||||
'Is Active': 'Je aktivní',
|
||||
'It is %s %%{day} today.': 'Dnes je to %s %%{den}.',
|
||||
'Key': 'Klíč',
|
||||
'Key bindings': 'Vazby klíčů',
|
||||
'Key bindings for ZenCoding Plugin': 'Key bindings for ZenCoding Plugin',
|
||||
'languages': 'jazyky',
|
||||
'Languages': 'Jazyky',
|
||||
'Last name': 'Příjmení',
|
||||
'Last saved on:': 'Naposledy uloženo:',
|
||||
'Layout': 'Rozvržení stránky (layout)',
|
||||
'Layout Plugins': 'Moduly rozvržení stránky (Layout Plugins)',
|
||||
'Layouts': 'Rozvržení stránek',
|
||||
'License for': 'Licence pro',
|
||||
'Line number': 'Číslo řádku',
|
||||
'LineNo': 'Č.řádku',
|
||||
'Live Chat': 'Online pokec',
|
||||
'loading...': 'nahrávám...',
|
||||
'locals': 'locals',
|
||||
'Locals##debug': 'Lokální proměnné',
|
||||
'Logged in': 'Přihlášení proběhlo úspěšně',
|
||||
'Logged out': 'Odhlášení proběhlo úspěšně',
|
||||
'Login': 'Přihlásit se',
|
||||
'login': 'přihlásit se',
|
||||
'Login to the Administrative Interface': 'Přihlásit se do Správce aplikací',
|
||||
'logout': 'odhlásit se',
|
||||
'Logout': 'Odhlásit se',
|
||||
'Lost Password': 'Zapomněl jste heslo',
|
||||
'Lost password?': 'Zapomněl jste heslo?',
|
||||
'lost password?': 'zapomněl jste heslo?',
|
||||
'Manage': 'Manage',
|
||||
'Manage Cache': 'Manage Cache',
|
||||
'Menu Model': 'Model rozbalovací nabídky',
|
||||
'Models': 'Modely',
|
||||
'models': 'modely',
|
||||
'Modified By': 'Změněno - kým',
|
||||
'Modified On': 'Změněno - kdy',
|
||||
'Modules': 'Moduly',
|
||||
'modules': 'moduly',
|
||||
'My Sites': 'Správa aplikací',
|
||||
'Name': 'Jméno',
|
||||
'new application "%s" created': 'nová aplikace "%s" vytvořena',
|
||||
'New Application Wizard': 'Nový průvodce aplikací',
|
||||
'New application wizard': 'Nový průvodce aplikací',
|
||||
'New password': 'Nové heslo',
|
||||
'New Record': 'Nový záznam',
|
||||
'new record inserted': 'nový záznam byl založen',
|
||||
'New simple application': 'Vytvořit primitivní aplikaci',
|
||||
'next': 'next',
|
||||
'next 100 rows': 'dalších 100 řádků',
|
||||
'No databases in this application': 'V této aplikaci nejsou žádné databáze',
|
||||
'No Interaction yet': 'Ještě žádná interakce nenastala',
|
||||
'No ticket_storage.txt found under /private folder': 'Soubor ticket_storage.txt v adresáři /private nenalezen',
|
||||
'Object or table name': 'Objekt či tabulka',
|
||||
'Old password': 'Původní heslo',
|
||||
'online designer': 'online návrhář',
|
||||
'Online examples': 'Příklady online',
|
||||
'Open new app in new window': 'Open new app in new window',
|
||||
'or alternatively': 'or alternatively',
|
||||
'Or Get from URL:': 'Or Get from URL:',
|
||||
'or import from csv file': 'nebo importovat z .csv souboru',
|
||||
'Origin': 'Původ',
|
||||
'Original/Translation': 'Originál/Překlad',
|
||||
'Other Plugins': 'Ostatní moduly',
|
||||
'Other Recipes': 'Ostatní zásuvné moduly',
|
||||
'Overview': 'Přehled',
|
||||
'Overwrite installed app': 'Přepsat instalovanou aplikaci',
|
||||
'Pack all': 'Zabalit',
|
||||
'Pack compiled': 'Zabalit zkompilované',
|
||||
'pack plugin': 'pack plugin',
|
||||
'password': 'heslo',
|
||||
'Password': 'Heslo',
|
||||
"Password fields don't match": 'Hesla se neshodují',
|
||||
'Peeking at file': 'Peeking at file',
|
||||
'Please': 'Prosím',
|
||||
'Plugin "%s" in application': 'Plugin "%s" in application',
|
||||
'plugins': 'zásuvné moduly',
|
||||
'Plugins': 'Zásuvné moduly',
|
||||
'Plural Form #%s': 'Plural Form #%s',
|
||||
'Plural-Forms:': 'Množná čísla:',
|
||||
'Powered by': 'Poháněno',
|
||||
'Preface': 'Předmluva',
|
||||
'previous 100 rows': 'předchozích 100 řádků',
|
||||
'Private files': 'Soukromé soubory',
|
||||
'private files': 'soukromé soubory',
|
||||
'profile': 'profil',
|
||||
'Project Progress': 'Vývoj projektu',
|
||||
'Python': 'Python',
|
||||
'Query:': 'Dotaz:',
|
||||
'Quick Examples': 'Krátké příklady',
|
||||
'RAM': 'RAM',
|
||||
'RAM Cache Keys': 'Klíče RAM Cache',
|
||||
'Ram Cleared': 'RAM smazána',
|
||||
'Readme': 'Nápověda',
|
||||
'Recipes': 'Postupy jak na to',
|
||||
'Record': 'Záznam',
|
||||
'record does not exist': 'záznam neexistuje',
|
||||
'Record ID': 'ID záznamu',
|
||||
'Record id': 'id záznamu',
|
||||
'refresh': 'obnovte',
|
||||
'register': 'registrovat',
|
||||
'Register': 'Zaregistrovat se',
|
||||
'Registration identifier': 'Registrační identifikátor',
|
||||
'Registration key': 'Registrační klíč',
|
||||
'reload': 'reload',
|
||||
'Reload routes': 'Znovu nahrát cesty',
|
||||
'Remember me (for 30 days)': 'Zapamatovat na 30 dní',
|
||||
'Remove compiled': 'Odstranit zkompilované',
|
||||
'Removed Breakpoint on %s at line %s': 'Bod přerušení smazán - soubor %s na řádce %s',
|
||||
'Replace': 'Zaměnit',
|
||||
'Replace All': 'Zaměnit vše',
|
||||
'request': 'request',
|
||||
'Reset Password key': 'Reset registračního klíče',
|
||||
'response': 'response',
|
||||
'restart': 'restart',
|
||||
'restore': 'obnovit',
|
||||
'Retrieve username': 'Získat přihlašovací jméno',
|
||||
'return': 'return',
|
||||
'revert': 'vrátit se k původnímu',
|
||||
'Role': 'Role',
|
||||
'Rows in Table': 'Záznamy v tabulce',
|
||||
'Rows selected': 'Záznamů zobrazeno',
|
||||
'rules are not defined': 'pravidla nejsou definována',
|
||||
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Spustí testy v tomto souboru (ke spuštění všech testů, použijte tlačítko 'test')",
|
||||
'Running on %s': 'Běží na %s',
|
||||
'Save': 'Uložit',
|
||||
'Save file:': 'Save file:',
|
||||
'Save via Ajax': 'Uložit pomocí Ajaxu',
|
||||
'Saved file hash:': 'hash uloženého souboru:',
|
||||
'Semantic': 'Modul semantic',
|
||||
'Services': 'Služby',
|
||||
'session': 'session',
|
||||
'session expired': 'session expired',
|
||||
'Set Breakpoint on %s at line %s: %s': 'Bod přerušení nastaven v souboru %s na řádce %s: %s',
|
||||
'shell': 'příkazová řádka',
|
||||
'Singular Form': 'Singular Form',
|
||||
'Site': 'Správa aplikací',
|
||||
'Size of cache:': 'Velikost cache:',
|
||||
'skip to generate': 'skip to generate',
|
||||
'Sorry, could not find mercurial installed': 'Bohužel mercurial není nainstalován.',
|
||||
'Start a new app': 'Vytvořit novou aplikaci',
|
||||
'Start searching': 'Začít hledání',
|
||||
'Start wizard': 'Spustit průvodce',
|
||||
'state': 'stav',
|
||||
'Static': 'Static',
|
||||
'static': 'statické soubory',
|
||||
'Static files': 'Statické soubory',
|
||||
'Statistics': 'Statistika',
|
||||
'Step': 'Step',
|
||||
'step': 'step',
|
||||
'stop': 'stop',
|
||||
'Stylesheet': 'CSS styly',
|
||||
'submit': 'odeslat',
|
||||
'Submit': 'Odeslat',
|
||||
'successful': 'úspěšně',
|
||||
'Support': 'Podpora',
|
||||
'Sure you want to delete this object?': 'Opravdu chcete smazat tento objekt?',
|
||||
'Table': 'tabulka',
|
||||
'Table name': 'Název tabulky',
|
||||
'Temporary': 'Dočasný',
|
||||
'test': 'test',
|
||||
'Testing application': 'Testing application',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': '"Dotaz" je podmínka, například "db.tabulka1.pole1==\'hodnota\'". Podmínka "db.tabulka1.pole1==db.tabulka2.pole2" pak vytvoří SQL JOIN.',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'Logika aplikace: každá URL je mapována na funkci vystavovanou kontrolérem.',
|
||||
'The Core': 'Jádro (The Core)',
|
||||
'The data representation, define database tables and sets': 'Reprezentace dat: definovat tabulky databáze a záznamy',
|
||||
'The output of the file is a dictionary that was rendered by the view %s': 'Výstup ze souboru je slovník, který se zobrazil v pohledu %s.',
|
||||
'The presentations layer, views are also known as templates': 'Prezentační vrstva: pohledy či templaty (šablony)',
|
||||
'The Views': 'Pohledy (The Views)',
|
||||
'There are no controllers': 'There are no controllers',
|
||||
'There are no modules': 'There are no modules',
|
||||
'There are no plugins': 'Žádné moduly nejsou instalovány.',
|
||||
'There are no private files': 'Žádné soukromé soubory neexistují.',
|
||||
'There are no static files': 'There are no static files',
|
||||
'There are no translators, only default language is supported': 'There are no translators, only default language is supported',
|
||||
'There are no views': 'There are no views',
|
||||
'These files are not served, they are only available from within your app': 'Tyto soubory jsou klientům nepřístupné. K dispozici jsou pouze v rámci aplikace.',
|
||||
'These files are served without processing, your images go here': 'Tyto soubory jsou servírovány bez přídavné logiky, sem patří např. obrázky.',
|
||||
'This App': 'Tato aplikace',
|
||||
'This is a copy of the scaffolding application': 'Toto je kopie aplikace skelet.',
|
||||
'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk': 'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk',
|
||||
'This is the %(filename)s template': 'This is the %(filename)s template',
|
||||
'this page to see if a breakpoint was hit and debug interaction is required.': 'tuto stránku, abyste uviděli, zda se dosáhlo bodu přerušení.',
|
||||
'Ticket': 'Ticket',
|
||||
'Ticket ID': 'Ticket ID',
|
||||
'Time in Cache (h:m:s)': 'Čas v Cache (h:m:s)',
|
||||
'Timestamp': 'Časové razítko',
|
||||
'to previous version.': 'k předchozí verzi.',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Zásuvný modul vytvoříte tak, že pojmenujete soubor/adresář plugin_[jméno modulu]',
|
||||
'To emulate a breakpoint programatically, write:': 'K nastavení bodu přerušení v kódu programu, napište:',
|
||||
'to use the debugger!': ', abyste mohli ladící program používat!',
|
||||
'toggle breakpoint': 'vyp./zap. bod přerušení',
|
||||
'Toggle Fullscreen': 'Na celou obrazovku a zpět',
|
||||
'too short': 'Příliš krátké',
|
||||
'Traceback': 'Traceback',
|
||||
'Translation strings for the application': 'Překlad textů pro aplikaci',
|
||||
'try something like': 'try something like',
|
||||
'Try the mobile interface': 'Zkuste rozhraní pro mobilní zařízení',
|
||||
'try view': 'try view',
|
||||
'Twitter': 'Twitter',
|
||||
'Type python statement in here and hit Return (Enter) to execute it.': 'Type python statement in here and hit Return (Enter) to execute it.',
|
||||
'Type some Python code in here and hit Return (Enter) to execute it.': 'Type some Python code in here and hit Return (Enter) to execute it.',
|
||||
'Unable to check for upgrades': 'Unable to check for upgrades',
|
||||
'unable to parse csv file': 'csv soubor nedá sa zpracovat',
|
||||
'uncheck all': 'vše odznačit',
|
||||
'Uninstall': 'Odinstalovat',
|
||||
'update': 'aktualizovat',
|
||||
'update all languages': 'aktualizovat všechny jazyky',
|
||||
'Update:': 'Upravit:',
|
||||
'Upgrade': 'Upgrade',
|
||||
'upgrade now': 'upgrade now',
|
||||
'upgrade now to %s': 'upgrade now to %s',
|
||||
'upload': 'nahrát',
|
||||
'Upload': 'Upload',
|
||||
'Upload a package:': 'Nahrát balík:',
|
||||
'Upload and install packed application': 'Nahrát a instalovat zabalenou aplikaci',
|
||||
'upload file:': 'nahrát soubor:',
|
||||
'upload plugin file:': 'nahrát soubor modulu:',
|
||||
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Použijte (...)&(...) pro AND, (...)|(...) pro OR a ~(...) pro NOT pro sestavení složitějších dotazů.',
|
||||
'User %(id)s Logged-in': 'Uživatel %(id)s přihlášen',
|
||||
'User %(id)s Logged-out': 'Uživatel %(id)s odhlášen',
|
||||
'User %(id)s Password changed': 'Uživatel %(id)s změnil heslo',
|
||||
'User %(id)s Profile updated': 'Uživatel %(id)s upravil profil',
|
||||
'User %(id)s Registered': 'Uživatel %(id)s se zaregistroval',
|
||||
'User %(id)s Username retrieved': 'Uživatel %(id)s si nachal zaslat přihlašovací jméno',
|
||||
'User ID': 'ID uživatele',
|
||||
'Username': 'Přihlašovací jméno',
|
||||
'variables': 'variables',
|
||||
'Verify Password': 'Zopakujte heslo',
|
||||
'Version': 'Verze',
|
||||
'Version %s.%s.%s (%s) %s': 'Verze %s.%s.%s (%s) %s',
|
||||
'Versioning': 'Verzování',
|
||||
'Videos': 'Videa',
|
||||
'View': 'Pohled (View)',
|
||||
'Views': 'Pohledy',
|
||||
'views': 'pohledy',
|
||||
'Web Framework': 'Web Framework',
|
||||
'web2py is up to date': 'Máte aktuální verzi web2py.',
|
||||
'web2py online debugger': 'Ladící online web2py program',
|
||||
'web2py Recent Tweets': 'Štěbetání na Twitteru o web2py',
|
||||
'web2py upgrade': 'web2py upgrade',
|
||||
'web2py upgraded; please restart it': 'web2py upgraded; please restart it',
|
||||
'Welcome': 'Vítejte',
|
||||
'Welcome to web2py': 'Vitejte ve web2py',
|
||||
'Welcome to web2py!': 'Vítejte ve web2py!',
|
||||
'Which called the function %s located in the file %s': 'která zavolala funkci %s v souboru (kontroléru) %s.',
|
||||
'You are successfully running web2py': 'Úspěšně jste spustili web2py.',
|
||||
'You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button': 'Nastavovat a mazat body přerušení je též možno v rámci editování zdrojového souboru přes tlačítko Vyp./Zap. bod přerušení',
|
||||
'You can modify this application and adapt it to your needs': 'Tuto aplikaci si můžete upravit a přizpůsobit ji svým potřebám.',
|
||||
'You need to set up and reach a': 'Je třeba nejprve nastavit a dojít až na',
|
||||
'You visited the url %s': 'Navštívili jste stránku %s,',
|
||||
'Your application will be blocked until you click an action button (next, step, continue, etc.)': 'Aplikace bude blokována než se klikne na jedno z tlačítek (další, krok, pokračovat, atd.)',
|
||||
'You can inspect variables using the console bellow': 'Níže pomocí příkazové řádky si můžete prohlédnout proměnné',
|
||||
}
|
||||
|
||||
@@ -1,100 +1,68 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# This scaffolding model makes your app work on Google App Engine too
|
||||
# File is released under public domain and you can use without limitations
|
||||
# -------------------------------------------------------------------------
|
||||
#########################################################################
|
||||
## This scaffolding model makes your app work on Google App Engine too
|
||||
## File is released under public domain and you can use without limitations
|
||||
#########################################################################
|
||||
|
||||
if request.global_settings.web2py_version < "2.14.1":
|
||||
raise HTTP(500, "Requires web2py 2.13.3 or newer")
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# if SSL/HTTPS is properly configured and you want all HTTP requests to
|
||||
# be redirected to HTTPS, uncomment the line below:
|
||||
# -------------------------------------------------------------------------
|
||||
## if SSL/HTTPS is properly configured and you want all HTTP requests to
|
||||
## be redirected to HTTPS, uncomment the line below:
|
||||
# request.requires_https()
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# app configuration made easy. Look inside private/appconfig.ini
|
||||
# -------------------------------------------------------------------------
|
||||
## app configuration made easy. Look inside private/appconfig.ini
|
||||
from gluon.contrib.appconfig import AppConfig
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# once in production, remove reload=True to gain full speed
|
||||
# -------------------------------------------------------------------------
|
||||
## once in production, remove reload=True to gain full speed
|
||||
myconf = AppConfig(reload=True)
|
||||
|
||||
if not request.env.web2py_runtime_gae:
|
||||
# ---------------------------------------------------------------------
|
||||
# if NOT running on Google App Engine use SQLite or other DB
|
||||
# ---------------------------------------------------------------------
|
||||
db = DAL(myconf.get('db.uri'),
|
||||
pool_size=myconf.get('db.pool_size'),
|
||||
migrate_enabled=myconf.get('db.migrate'),
|
||||
check_reserved=['all'])
|
||||
## if NOT running on Google App Engine use SQLite or other DB
|
||||
db = DAL(myconf.get('db.uri'),
|
||||
pool_size = myconf.get('db.pool_size'),
|
||||
migrate_enabled = myconf.get('db.migrate'),
|
||||
check_reserved = ['all'])
|
||||
else:
|
||||
# ---------------------------------------------------------------------
|
||||
# connect to Google BigTable (optional 'google:datastore://namespace')
|
||||
# ---------------------------------------------------------------------
|
||||
## connect to Google BigTable (optional 'google:datastore://namespace')
|
||||
db = DAL('google:datastore+ndb')
|
||||
# ---------------------------------------------------------------------
|
||||
# store sessions and tickets there
|
||||
# ---------------------------------------------------------------------
|
||||
## store sessions and tickets there
|
||||
session.connect(request, response, db=db)
|
||||
# ---------------------------------------------------------------------
|
||||
# or store session in Memcache, Redis, etc.
|
||||
# from gluon.contrib.memdb import MEMDB
|
||||
# from google.appengine.api.memcache import Client
|
||||
# session.connect(request, response, db = MEMDB(Client()))
|
||||
# ---------------------------------------------------------------------
|
||||
## or store session in Memcache, Redis, etc.
|
||||
## from gluon.contrib.memdb import MEMDB
|
||||
## from google.appengine.api.memcache import Client
|
||||
## session.connect(request, response, db = MEMDB(Client()))
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# by default give a view/generic.extension to all actions from localhost
|
||||
# none otherwise. a pattern can be 'controller/function.extension'
|
||||
# -------------------------------------------------------------------------
|
||||
## by default give a view/generic.extension to all actions from localhost
|
||||
## none otherwise. a pattern can be 'controller/function.extension'
|
||||
response.generic_patterns = ['*'] if request.is_local else []
|
||||
# -------------------------------------------------------------------------
|
||||
# choose a style for forms
|
||||
# -------------------------------------------------------------------------
|
||||
## choose a style for forms
|
||||
response.formstyle = myconf.get('forms.formstyle') # or 'bootstrap3_stacked' or 'bootstrap2' or other
|
||||
response.form_label_separator = myconf.get('forms.separator') or ''
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# (optional) optimize handling of static files
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
## (optional) optimize handling of static files
|
||||
# response.optimize_css = 'concat,minify,inline'
|
||||
# response.optimize_js = 'concat,minify,inline'
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# (optional) static assets folder versioning
|
||||
# -------------------------------------------------------------------------
|
||||
## (optional) static assets folder versioning
|
||||
# response.static_version = '0.0.0'
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Here is sample code if you need for
|
||||
# - email capabilities
|
||||
# - authentication (registration, login, logout, ... )
|
||||
# - authorization (role based authorization)
|
||||
# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
|
||||
# - old style crud actions
|
||||
# (more options discussed in gluon/tools.py)
|
||||
# -------------------------------------------------------------------------
|
||||
#########################################################################
|
||||
## Here is sample code if you need for
|
||||
## - email capabilities
|
||||
## - authentication (registration, login, logout, ... )
|
||||
## - authorization (role based authorization)
|
||||
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
|
||||
## - old style crud actions
|
||||
## (more options discussed in gluon/tools.py)
|
||||
#########################################################################
|
||||
|
||||
from gluon.tools import Auth, Service, PluginManager
|
||||
|
||||
# host names must be a list of allowed host names (glob syntax allowed)
|
||||
auth = Auth(db, host_names=myconf.get('host.names'))
|
||||
auth = Auth(db, host=myconf.get('host.name'))
|
||||
service = Service()
|
||||
plugins = PluginManager()
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# create all tables needed by auth if not custom tables
|
||||
# -------------------------------------------------------------------------
|
||||
## create all tables needed by auth if not custom tables
|
||||
auth.define_tables(username=False, signature=False)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# configure email
|
||||
# -------------------------------------------------------------------------
|
||||
## configure email
|
||||
mail = auth.settings.mailer
|
||||
mail.settings.server = 'logging' if request.is_local else myconf.get('smtp.server')
|
||||
mail.settings.sender = myconf.get('smtp.sender')
|
||||
@@ -102,31 +70,27 @@ mail.settings.login = myconf.get('smtp.login')
|
||||
mail.settings.tls = myconf.get('smtp.tls') or False
|
||||
mail.settings.ssl = myconf.get('smtp.ssl') or False
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# configure auth policy
|
||||
# -------------------------------------------------------------------------
|
||||
## configure auth policy
|
||||
auth.settings.registration_requires_verification = False
|
||||
auth.settings.registration_requires_approval = False
|
||||
auth.settings.reset_password_requires_verification = True
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Define your tables below (or better in another model file) for example
|
||||
#
|
||||
# >>> db.define_table('mytable', Field('myfield', 'string'))
|
||||
#
|
||||
# Fields can be 'string','text','password','integer','double','boolean'
|
||||
# 'date','time','datetime','blob','upload', 'reference TABLENAME'
|
||||
# There is an implicit 'id integer autoincrement' field
|
||||
# Consult manual for more options, validators, etc.
|
||||
#
|
||||
# More API examples for controllers:
|
||||
#
|
||||
# >>> db.mytable.insert(myfield='value')
|
||||
# >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL)
|
||||
# >>> for row in rows: print row.id, row.myfield
|
||||
# -------------------------------------------------------------------------
|
||||
#########################################################################
|
||||
## Define your tables below (or better in another model file) for example
|
||||
##
|
||||
## >>> db.define_table('mytable',Field('myfield','string'))
|
||||
##
|
||||
## Fields can be 'string','text','password','integer','double','boolean'
|
||||
## 'date','time','datetime','blob','upload', 'reference TABLENAME'
|
||||
## There is an implicit 'id integer autoincrement' field
|
||||
## Consult manual for more options, validators, etc.
|
||||
##
|
||||
## More API examples for controllers:
|
||||
##
|
||||
## >>> db.mytable.insert(myfield='value')
|
||||
## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
|
||||
## >>> for row in rows: print row.id, row.myfield
|
||||
#########################################################################
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# after defining tables, uncomment below to enable auditing
|
||||
# -------------------------------------------------------------------------
|
||||
## after defining tables, uncomment below to enable auditing
|
||||
# auth.enable_record_versioning(db)
|
||||
|
||||
+108
-121
@@ -1,32 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# this file is released under public domain and you can use without limitations
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# Customize your APP title, subtitle and menus here
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
#########################################################################
|
||||
## Customize your APP title, subtitle and menus here
|
||||
#########################################################################
|
||||
|
||||
response.logo = A(B('web', SPAN(2), 'py'), XML('™ '),
|
||||
_class="navbar-brand", _href="http://www.web2py.com/",
|
||||
response.logo = A(B('web',SPAN(2),'py'),XML('™ '),
|
||||
_class="navbar-brand",_href="http://www.web2py.com/",
|
||||
_id="web2py-logo")
|
||||
response.title = request.application.replace('_', ' ').title()
|
||||
response.title = request.application.replace('_',' ').title()
|
||||
response.subtitle = ''
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# read more at http://dev.w3.org/html5/markup/meta.name.html
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
## read more at http://dev.w3.org/html5/markup/meta.name.html
|
||||
response.meta.author = myconf.get('app.author')
|
||||
response.meta.description = myconf.get('app.description')
|
||||
response.meta.keywords = myconf.get('app.keywords')
|
||||
response.meta.generator = myconf.get('app.generator')
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# your http://google.com/analytics id
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
## your http://google.com/analytics id
|
||||
response.google_analytics_id = None
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# this is the main application menu add/remove items as required
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
#########################################################################
|
||||
## this is the main application menu add/remove items as required
|
||||
#########################################################################
|
||||
|
||||
response.menu = [
|
||||
(T('Home'), False, URL('default', 'index'), [])
|
||||
@@ -34,118 +30,109 @@ response.menu = [
|
||||
|
||||
DEVELOPMENT_MENU = True
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# provide shortcuts for development. remove in production
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
#########################################################################
|
||||
## provide shortcuts for development. remove in production
|
||||
#########################################################################
|
||||
|
||||
def _():
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
# shortcuts
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
app = request.application
|
||||
ctr = request.controller
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
# useful links to internal and external resources
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
response.menu += [
|
||||
(T('My Sites'), False, URL('admin', 'default', 'site')),
|
||||
(T('This App'), False, '#', [
|
||||
(T('Design'), False, URL('admin', 'default', 'design/%s' % app)),
|
||||
LI(_class="divider"),
|
||||
(T('Controller'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/controllers/%s.py' % (app, ctr))),
|
||||
(T('View'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/views/%s' % (app, response.view))),
|
||||
(T('DB Model'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/models/db.py' % app)),
|
||||
(T('Menu Model'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/models/menu.py' % app)),
|
||||
(T('Config.ini'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/private/appconfig.ini' % app)),
|
||||
(T('Layout'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/views/layout.html' % app)),
|
||||
(T('Stylesheet'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % app)),
|
||||
(T('Database'), False, URL(app, 'appadmin', 'index')),
|
||||
(T('Errors'), False, URL(
|
||||
'admin', 'default', 'errors/' + app)),
|
||||
(T('About'), False, URL(
|
||||
'admin', 'default', 'about/' + app)),
|
||||
]),
|
||||
('web2py.com', False, '#', [
|
||||
(T('Download'), False,
|
||||
'http://www.web2py.com/examples/default/download'),
|
||||
(T('Support'), False,
|
||||
'http://www.web2py.com/examples/default/support'),
|
||||
(T('Demo'), False, 'http://web2py.com/demo_admin'),
|
||||
(T('Quick Examples'), False,
|
||||
'http://web2py.com/examples/default/examples'),
|
||||
(T('FAQ'), False, 'http://web2py.com/AlterEgo'),
|
||||
(T('Videos'), False,
|
||||
'http://www.web2py.com/examples/default/videos/'),
|
||||
(T('Free Applications'),
|
||||
False, 'http://web2py.com/appliances'),
|
||||
(T('Plugins'), False, 'http://web2py.com/plugins'),
|
||||
(T('Recipes'), False, 'http://web2pyslices.com/'),
|
||||
]),
|
||||
(T('Documentation'), False, '#', [
|
||||
(T('Online book'), False, 'http://www.web2py.com/book'),
|
||||
LI(_class="divider"),
|
||||
(T('Preface'), False,
|
||||
'http://www.web2py.com/book/default/chapter/00'),
|
||||
(T('Introduction'), False,
|
||||
'http://www.web2py.com/book/default/chapter/01'),
|
||||
(T('Python'), False,
|
||||
'http://www.web2py.com/book/default/chapter/02'),
|
||||
(T('Overview'), False,
|
||||
'http://www.web2py.com/book/default/chapter/03'),
|
||||
(T('The Core'), False,
|
||||
'http://www.web2py.com/book/default/chapter/04'),
|
||||
(T('The Views'), False,
|
||||
'http://www.web2py.com/book/default/chapter/05'),
|
||||
(T('Database'), False,
|
||||
'http://www.web2py.com/book/default/chapter/06'),
|
||||
(T('Forms and Validators'), False,
|
||||
'http://www.web2py.com/book/default/chapter/07'),
|
||||
(T('Email and SMS'), False,
|
||||
'http://www.web2py.com/book/default/chapter/08'),
|
||||
(T('Access Control'), False,
|
||||
'http://www.web2py.com/book/default/chapter/09'),
|
||||
(T('Services'), False,
|
||||
'http://www.web2py.com/book/default/chapter/10'),
|
||||
(T('Ajax Recipes'), False,
|
||||
'http://www.web2py.com/book/default/chapter/11'),
|
||||
(T('Components and Plugins'), False,
|
||||
'http://www.web2py.com/book/default/chapter/12'),
|
||||
(T('Deployment Recipes'), False,
|
||||
'http://www.web2py.com/book/default/chapter/13'),
|
||||
(T('Other Recipes'), False,
|
||||
'http://www.web2py.com/book/default/chapter/14'),
|
||||
(T('Helping web2py'), False,
|
||||
'http://www.web2py.com/book/default/chapter/15'),
|
||||
(T("Buy web2py's book"), False,
|
||||
'http://stores.lulu.com/web2py'),
|
||||
]),
|
||||
(T('Community'), False, None, [
|
||||
(T('Groups'), False,
|
||||
'http://www.web2py.com/examples/default/usergroups'),
|
||||
(T('Twitter'), False, 'http://twitter.com/web2py'),
|
||||
(T('Live Chat'), False,
|
||||
'http://webchat.freenode.net/?channels=web2py'),
|
||||
]),
|
||||
]
|
||||
(T('This App'), False, '#', [
|
||||
(T('Design'), False, URL('admin', 'default', 'design/%s' % app)),
|
||||
LI(_class="divider"),
|
||||
(T('Controller'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/controllers/%s.py' % (app, ctr))),
|
||||
(T('View'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/views/%s' % (app, response.view))),
|
||||
(T('DB Model'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/models/db.py' % app)),
|
||||
(T('Menu Model'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/models/menu.py' % app)),
|
||||
(T('Config.ini'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/private/appconfig.ini' % app)),
|
||||
(T('Layout'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/views/layout.html' % app)),
|
||||
(T('Stylesheet'), False,
|
||||
URL(
|
||||
'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % app)),
|
||||
(T('Database'), False, URL(app, 'appadmin', 'index')),
|
||||
(T('Errors'), False, URL(
|
||||
'admin', 'default', 'errors/' + app)),
|
||||
(T('About'), False, URL(
|
||||
'admin', 'default', 'about/' + app)),
|
||||
]),
|
||||
('web2py.com', False, '#', [
|
||||
(T('Download'), False,
|
||||
'http://www.web2py.com/examples/default/download'),
|
||||
(T('Support'), False,
|
||||
'http://www.web2py.com/examples/default/support'),
|
||||
(T('Demo'), False, 'http://web2py.com/demo_admin'),
|
||||
(T('Quick Examples'), False,
|
||||
'http://web2py.com/examples/default/examples'),
|
||||
(T('FAQ'), False, 'http://web2py.com/AlterEgo'),
|
||||
(T('Videos'), False,
|
||||
'http://www.web2py.com/examples/default/videos/'),
|
||||
(T('Free Applications'),
|
||||
False, 'http://web2py.com/appliances'),
|
||||
(T('Plugins'), False, 'http://web2py.com/plugins'),
|
||||
(T('Recipes'), False, 'http://web2pyslices.com/'),
|
||||
]),
|
||||
(T('Documentation'), False, '#', [
|
||||
(T('Online book'), False, 'http://www.web2py.com/book'),
|
||||
LI(_class="divider"),
|
||||
(T('Preface'), False,
|
||||
'http://www.web2py.com/book/default/chapter/00'),
|
||||
(T('Introduction'), False,
|
||||
'http://www.web2py.com/book/default/chapter/01'),
|
||||
(T('Python'), False,
|
||||
'http://www.web2py.com/book/default/chapter/02'),
|
||||
(T('Overview'), False,
|
||||
'http://www.web2py.com/book/default/chapter/03'),
|
||||
(T('The Core'), False,
|
||||
'http://www.web2py.com/book/default/chapter/04'),
|
||||
(T('The Views'), False,
|
||||
'http://www.web2py.com/book/default/chapter/05'),
|
||||
(T('Database'), False,
|
||||
'http://www.web2py.com/book/default/chapter/06'),
|
||||
(T('Forms and Validators'), False,
|
||||
'http://www.web2py.com/book/default/chapter/07'),
|
||||
(T('Email and SMS'), False,
|
||||
'http://www.web2py.com/book/default/chapter/08'),
|
||||
(T('Access Control'), False,
|
||||
'http://www.web2py.com/book/default/chapter/09'),
|
||||
(T('Services'), False,
|
||||
'http://www.web2py.com/book/default/chapter/10'),
|
||||
(T('Ajax Recipes'), False,
|
||||
'http://www.web2py.com/book/default/chapter/11'),
|
||||
(T('Components and Plugins'), False,
|
||||
'http://www.web2py.com/book/default/chapter/12'),
|
||||
(T('Deployment Recipes'), False,
|
||||
'http://www.web2py.com/book/default/chapter/13'),
|
||||
(T('Other Recipes'), False,
|
||||
'http://www.web2py.com/book/default/chapter/14'),
|
||||
(T('Helping web2py'), False,
|
||||
'http://www.web2py.com/book/default/chapter/15'),
|
||||
(T("Buy web2py's book"), False,
|
||||
'http://stores.lulu.com/web2py'),
|
||||
]),
|
||||
(T('Community'), False, None, [
|
||||
(T('Groups'), False,
|
||||
'http://www.web2py.com/examples/default/usergroups'),
|
||||
(T('Twitter'), False, 'http://twitter.com/web2py'),
|
||||
(T('Live Chat'), False,
|
||||
'http://webchat.freenode.net/?channels=web2py'),
|
||||
]),
|
||||
]
|
||||
if DEVELOPMENT_MENU: _()
|
||||
|
||||
|
||||
if DEVELOPMENT_MENU:
|
||||
_()
|
||||
|
||||
if "auth" in locals():
|
||||
auth.wikimenu()
|
||||
if "auth" in locals(): auth.wikimenu()
|
||||
|
||||
@@ -8,7 +8,7 @@ generator = Web2py Web Framework
|
||||
|
||||
; Host configuration
|
||||
[host]
|
||||
names = localhost:*, 127.0.0.1:*, *:*, *
|
||||
name = localhost
|
||||
|
||||
; db configuration
|
||||
[db]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# This is an app-specific example router
|
||||
#
|
||||
# This simple router is used for setting languages from app/languages directory
|
||||
@@ -9,33 +8,31 @@
|
||||
# a default_language
|
||||
#
|
||||
# See <web2py-root-dir>/examples/routes.parametric.example.py for parameter's detail
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------------
|
||||
# To enable this route file you must do the steps:
|
||||
#
|
||||
# 1. rename <web2py-root-dir>/examples/routes.parametric.example.py to routes.py
|
||||
# 2. rename this APP/routes.example.py to APP/routes.py (where APP - is your application directory)
|
||||
# 3. restart web2py (or reload routes in web2py admin interface)
|
||||
# 2. rename this APP/routes.example.py to APP/routes.py
|
||||
# (where APP - is your application directory)
|
||||
# 3. restart web2py (or reload routes in web2py admin interfase)
|
||||
#
|
||||
# YOU CAN COPY THIS FILE TO ANY APPLICATION'S ROOT DIRECTORY WITHOUT CHANGES!
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
from fileutils import abspath
|
||||
from languages import read_possible_languages
|
||||
|
||||
possible_languages = read_possible_languages(abspath('applications', app))
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# NOTE! app - is an application based router's parameter with name of an application. E.g.'welcome'
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
#NOTE! app - is an application based router's parameter with name of an
|
||||
# application. E.g.'welcome'
|
||||
|
||||
routers = {
|
||||
app: dict(
|
||||
default_language=possible_languages['default'][0],
|
||||
languages=[lang for lang in possible_languages if lang != 'default']
|
||||
default_language = possible_languages['default'][0],
|
||||
languages = [lang for lang in possible_languages
|
||||
if lang != 'default']
|
||||
)
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# NOTE! To change language in your application using these rules add this line in one of your models files:
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
#NOTE! To change language in your application using these rules add this line
|
||||
#in one of your models files:
|
||||
# if request.uri_language: T.force(request.uri_language)
|
||||
|
||||
+5
-5
File diff suppressed because one or more lines are too long
+3
-3
@@ -148,7 +148,7 @@ def app_compile(app, request, skip_failed_views=False):
|
||||
failed_views = compile_application(folder, skip_failed_views)
|
||||
return failed_views
|
||||
except (Exception, RestrictedError):
|
||||
tb = traceback.format_exc()
|
||||
tb = traceback.format_exc(sys.exc_info)
|
||||
remove_compiled_application(folder)
|
||||
return tb
|
||||
|
||||
@@ -167,7 +167,7 @@ def app_create(app, request, force=False, key=None, info=False):
|
||||
os.mkdir(path)
|
||||
except:
|
||||
if info:
|
||||
return False, traceback.format_exc()
|
||||
return False, traceback.format_exc(sys.exc_info)
|
||||
else:
|
||||
return False
|
||||
elif not force:
|
||||
@@ -197,7 +197,7 @@ def app_create(app, request, force=False, key=None, info=False):
|
||||
except:
|
||||
rmtree(path)
|
||||
if info:
|
||||
return False, traceback.format_exc()
|
||||
return False, traceback.format_exc(sys.exc_info)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
+50
-37
@@ -44,9 +44,9 @@ except ImportError:
|
||||
have_settings = False
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
import cPickle as pickle
|
||||
except:
|
||||
import pickle
|
||||
import pickle
|
||||
|
||||
try:
|
||||
import psutil
|
||||
@@ -54,7 +54,6 @@ try:
|
||||
except ImportError:
|
||||
HAVE_PSUTIL = False
|
||||
|
||||
|
||||
def remove_oldest_entries(storage, percentage=90):
|
||||
# compute current memory usage (%)
|
||||
old_mem = psutil.virtual_memory().percent
|
||||
@@ -67,8 +66,7 @@ def remove_oldest_entries(storage, percentage=90):
|
||||
# comute used memory again
|
||||
new_mem = psutil.virtual_memory().percent
|
||||
# if the used memory did not decrease stop
|
||||
if new_mem >= old_mem:
|
||||
break
|
||||
if new_mem >= old_mem: break
|
||||
# net new measurement for memory usage and loop
|
||||
old_mem = new_mem
|
||||
|
||||
@@ -80,7 +78,6 @@ __all__ = ['Cache', 'lazy_cache']
|
||||
|
||||
DEFAULT_TIME_EXPIRE = 300
|
||||
|
||||
|
||||
class CacheAbstract(object):
|
||||
"""
|
||||
Abstract class for cache implementations.
|
||||
@@ -102,7 +99,7 @@ class CacheAbstract(object):
|
||||
"""
|
||||
|
||||
cache_stats_name = 'web2py_cache_statistics'
|
||||
max_ram_utilization = None # percent
|
||||
max_ram_utilization = None # percent
|
||||
|
||||
def __init__(self, request=None):
|
||||
"""Initializes the object
|
||||
@@ -185,14 +182,13 @@ class CacheInRam(CacheAbstract):
|
||||
self.request = request
|
||||
self.storage = OrderedDict() if HAVE_PSUTIL else {}
|
||||
self.app = request.application if request else ''
|
||||
|
||||
def initialize(self):
|
||||
if self.initialized:
|
||||
return
|
||||
else:
|
||||
self.initialized = True
|
||||
self.locker.acquire()
|
||||
if self.app not in self.meta_storage:
|
||||
if not self.app in self.meta_storage:
|
||||
self.storage = self.meta_storage[self.app] = \
|
||||
OrderedDict() if HAVE_PSUTIL else {}
|
||||
self.stats[self.app] = {'hit_total': 0, 'misses': 0}
|
||||
@@ -209,7 +205,7 @@ class CacheInRam(CacheAbstract):
|
||||
else:
|
||||
self._clear(storage, regex)
|
||||
|
||||
if self.app not in self.stats:
|
||||
if not self.app in self.stats:
|
||||
self.stats[self.app] = {'hit_total': 0, 'misses': 0}
|
||||
|
||||
self.locker.release()
|
||||
@@ -255,8 +251,8 @@ class CacheInRam(CacheAbstract):
|
||||
self.locker.acquire()
|
||||
self.storage[key] = (now, value)
|
||||
self.stats[self.app]['misses'] += 1
|
||||
if HAVE_PSUTIL and self.max_ram_utilization is not None and random.random() < 0.10:
|
||||
remove_oldest_entries(self.storage, percentage=self.max_ram_utilization)
|
||||
if HAVE_PSUTIL and self.max_ram_utilization!=None and random.random()<0.10:
|
||||
remove_oldest_entries(self.storage, percentage = self.max_ram_utilization)
|
||||
self.locker.release()
|
||||
return value
|
||||
|
||||
@@ -296,15 +292,14 @@ class CacheOnDisk(CacheAbstract):
|
||||
self.folder = folder
|
||||
self.key_filter_in = lambda key: key
|
||||
self.key_filter_out = lambda key: key
|
||||
self.file_lock_time_wait = file_lock_time_wait
|
||||
# How long we should wait before retrying to lock a file held by another process
|
||||
self.file_lock_time_wait = file_lock_time_wait # How long we should wait before retrying to lock a file held by another process
|
||||
# We still need a mutex for each file as portalocker only blocks other processes
|
||||
self.file_locks = defaultdict(thread.allocate_lock)
|
||||
|
||||
|
||||
# Make sure we use valid filenames.
|
||||
if sys.platform == "win32":
|
||||
import base64
|
||||
|
||||
def key_filter_in_windows(key):
|
||||
"""
|
||||
Windows doesn't allow \ / : * ? "< > | in filenames.
|
||||
@@ -321,6 +316,7 @@ class CacheOnDisk(CacheAbstract):
|
||||
self.key_filter_in = key_filter_in_windows
|
||||
self.key_filter_out = key_filter_out_windows
|
||||
|
||||
|
||||
def wait_portalock(self, val_file):
|
||||
"""
|
||||
Wait for the process file lock.
|
||||
@@ -332,12 +328,15 @@ class CacheOnDisk(CacheAbstract):
|
||||
except:
|
||||
time.sleep(self.file_lock_time_wait)
|
||||
|
||||
|
||||
def acquire(self, key):
|
||||
self.file_locks[key].acquire()
|
||||
|
||||
|
||||
def release(self, key):
|
||||
self.file_locks[key].release()
|
||||
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
key = self.key_filter_in(key)
|
||||
val_file = recfile.open(key, mode='wb', path=self.folder)
|
||||
@@ -345,6 +344,7 @@ class CacheOnDisk(CacheAbstract):
|
||||
pickle.dump(value, val_file, pickle.HIGHEST_PROTOCOL)
|
||||
val_file.close()
|
||||
|
||||
|
||||
def __getitem__(self, key):
|
||||
key = self.key_filter_in(key)
|
||||
try:
|
||||
@@ -357,10 +357,12 @@ class CacheOnDisk(CacheAbstract):
|
||||
val_file.close()
|
||||
return value
|
||||
|
||||
|
||||
def __contains__(self, key):
|
||||
key = self.key_filter_in(key)
|
||||
return (key in self.file_locks) or recfile.exists(key, path=self.folder)
|
||||
|
||||
|
||||
def __delitem__(self, key):
|
||||
key = self.key_filter_in(key)
|
||||
try:
|
||||
@@ -368,11 +370,13 @@ class CacheOnDisk(CacheAbstract):
|
||||
except IOError:
|
||||
raise KeyError
|
||||
|
||||
|
||||
def __iter__(self):
|
||||
for dirpath, dirnames, filenames in os.walk(self.folder):
|
||||
for filename in filenames:
|
||||
yield self.key_filter_out(filename)
|
||||
|
||||
|
||||
def safe_apply(self, key, function, default_value=None):
|
||||
"""
|
||||
Safely apply a function to the value of a key in storage and set
|
||||
@@ -399,21 +403,25 @@ class CacheOnDisk(CacheAbstract):
|
||||
val_file.close()
|
||||
return new_value
|
||||
|
||||
|
||||
def keys(self):
|
||||
return list(self.__iter__())
|
||||
|
||||
|
||||
def get(self, key, default=None):
|
||||
try:
|
||||
return self[key]
|
||||
except KeyError:
|
||||
return default
|
||||
|
||||
|
||||
def __init__(self, request=None, folder=None):
|
||||
self.initialized = False
|
||||
self.request = request
|
||||
self.folder = folder
|
||||
self.storage = None
|
||||
|
||||
|
||||
def initialize(self):
|
||||
if self.initialized:
|
||||
return
|
||||
@@ -432,6 +440,7 @@ class CacheOnDisk(CacheAbstract):
|
||||
|
||||
self.storage = CacheOnDisk.PersistentStorage(folder)
|
||||
|
||||
|
||||
def __call__(self, key, f,
|
||||
time_expire=DEFAULT_TIME_EXPIRE):
|
||||
self.initialize()
|
||||
@@ -478,6 +487,7 @@ class CacheOnDisk(CacheAbstract):
|
||||
self.storage.release(key)
|
||||
return value
|
||||
|
||||
|
||||
def clear(self, regex=None):
|
||||
self.initialize()
|
||||
storage = self.storage
|
||||
@@ -494,6 +504,7 @@ class CacheOnDisk(CacheAbstract):
|
||||
pass
|
||||
storage.release(key)
|
||||
|
||||
|
||||
def increment(self, key, value=1):
|
||||
self.initialize()
|
||||
self.storage.acquire(key)
|
||||
@@ -502,6 +513,7 @@ class CacheOnDisk(CacheAbstract):
|
||||
return value
|
||||
|
||||
|
||||
|
||||
class CacheAction(object):
|
||||
def __init__(self, func, key, time_expire, cache, cache_model):
|
||||
self.__name__ = func.__name__
|
||||
@@ -560,9 +572,9 @@ class Cache(object):
|
||||
logger.warning('no cache.disk (AttributeError)')
|
||||
|
||||
def action(self, time_expire=DEFAULT_TIME_EXPIRE, cache_model=None,
|
||||
prefix=None, session=False, vars=True, lang=True,
|
||||
user_agent=False, public=True, valid_statuses=None,
|
||||
quick=None):
|
||||
prefix=None, session=False, vars=True, lang=True,
|
||||
user_agent=False, public=True, valid_statuses=None,
|
||||
quick=None):
|
||||
"""Better fit for caching an action
|
||||
|
||||
Warning:
|
||||
@@ -590,7 +602,6 @@ class Cache(object):
|
||||
"""
|
||||
from gluon import current
|
||||
from gluon.http import HTTP
|
||||
|
||||
def wrap(func):
|
||||
def wrapped_f():
|
||||
if current.request.env.request_method != 'GET':
|
||||
@@ -610,14 +621,13 @@ class Cache(object):
|
||||
cache_control = 'max-age=%(time_expire)s, s-maxage=%(time_expire)s' % dict(time_expire=time_expire)
|
||||
if not session_ and public_:
|
||||
cache_control += ', public'
|
||||
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)
|
||||
).strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||
else:
|
||||
cache_control += ', private'
|
||||
expires = 'Fri, 01 Jan 1990 00:00:00 GMT'
|
||||
|
||||
if cache_model:
|
||||
# figure out the correct cache key
|
||||
#figure out the correct cache key
|
||||
cache_key = [current.request.env.path_info, current.response.view]
|
||||
if session_:
|
||||
cache_key.append(current.response.session_id)
|
||||
@@ -634,28 +644,28 @@ class Cache(object):
|
||||
if prefix:
|
||||
cache_key = prefix + cache_key
|
||||
try:
|
||||
# action returns something
|
||||
rtn = cache_model(cache_key, lambda: func(), time_expire=time_expire)
|
||||
#action returns something
|
||||
rtn = cache_model(cache_key, lambda : func(), time_expire=time_expire)
|
||||
http, status = None, current.response.status
|
||||
except HTTP, e:
|
||||
# action raises HTTP (can still be valid)
|
||||
rtn = cache_model(cache_key, lambda: e.body, time_expire=time_expire)
|
||||
#action raises HTTP (can still be valid)
|
||||
rtn = cache_model(cache_key, lambda : e.body, time_expire=time_expire)
|
||||
http, status = HTTP(e.status, rtn, **e.headers), e.status
|
||||
else:
|
||||
# action raised a generic exception
|
||||
#action raised a generic exception
|
||||
http = None
|
||||
else:
|
||||
# no server-cache side involved
|
||||
#no server-cache side involved
|
||||
try:
|
||||
# action returns something
|
||||
#action returns something
|
||||
rtn = func()
|
||||
http, status = None, current.response.status
|
||||
except HTTP, e:
|
||||
# action raises HTTP (can still be valid)
|
||||
#action raises HTTP (can still be valid)
|
||||
status = e.status
|
||||
http = HTTP(e.status, e.body, **e.headers)
|
||||
else:
|
||||
# action raised a generic exception
|
||||
#action raised a generic exception
|
||||
http = None
|
||||
send_headers = False
|
||||
if http and isinstance(valid_statuses, list):
|
||||
@@ -665,13 +675,15 @@ class Cache(object):
|
||||
if str(status)[0] in '123':
|
||||
send_headers = True
|
||||
if send_headers:
|
||||
headers = {'Pragma': None,
|
||||
'Expires': expires,
|
||||
'Cache-Control': cache_control}
|
||||
headers = {
|
||||
'Pragma' : None,
|
||||
'Expires' : expires,
|
||||
'Cache-Control' : cache_control
|
||||
}
|
||||
current.response.headers.update(headers)
|
||||
if cache_model and not send_headers:
|
||||
# we cached already the value, but the status is not valid
|
||||
# so we need to delete the cached value
|
||||
#we cached already the value, but the status is not valid
|
||||
#so we need to delete the cached value
|
||||
cache_model(cache_key, None)
|
||||
if http:
|
||||
if send_headers:
|
||||
@@ -728,7 +740,8 @@ class Cache(object):
|
||||
allow replacing cache.ram with cache.with_prefix(cache.ram,'prefix')
|
||||
it will add prefix to all the cache keys used.
|
||||
"""
|
||||
return lambda key, f, time_expire=DEFAULT_TIME_EXPIRE, prefix=prefix: cache_model(prefix + key, f, time_expire)
|
||||
return lambda key, f, time_expire=DEFAULT_TIME_EXPIRE, prefix=prefix:\
|
||||
cache_model(prefix + key, f, time_expire)
|
||||
|
||||
|
||||
def lazy_cache(key=None, time_expire=None, cache_model='ram'):
|
||||
|
||||
@@ -69,8 +69,8 @@ class AppConfigDict(dict):
|
||||
return False
|
||||
elif value.isdigit() or (value[0]=='-' and value[1:].isdigit()):
|
||||
return int(value)
|
||||
elif ',' in value:
|
||||
return map(lambda x:x.strip(),value.split(','))
|
||||
elif ', ' in value:
|
||||
return value.split(', ')
|
||||
else:
|
||||
try:
|
||||
return float(value)
|
||||
|
||||
+748
-742
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ from gluon import current
|
||||
|
||||
class RESIZE(object):
|
||||
|
||||
def __init__(self, nx=160, ny=80, quality=100, padding = False,
|
||||
def __init__(self, nx=160, ny=80, quality=100, padding = False
|
||||
error_message=' image resize'):
|
||||
(self.nx, self.ny, self.quality, self.error_message, self.padding) = (
|
||||
nx, ny, quality, error_message, padding)
|
||||
|
||||
@@ -36,13 +36,11 @@ def ldap_auth(server='ldap',
|
||||
user_lastname_attrib='cn:2',
|
||||
user_mail_attrib='mail',
|
||||
manage_groups=False,
|
||||
manage_groups_callback=[],
|
||||
db=None,
|
||||
group_dn=None,
|
||||
group_name_attrib='cn',
|
||||
group_member_attrib='memberUid',
|
||||
group_filterstr='objectClass=*',
|
||||
group_mapping={},
|
||||
tls=False,
|
||||
logging_level='error'):
|
||||
|
||||
@@ -209,7 +207,6 @@ def ldap_auth(server='ldap',
|
||||
user_mail_attrib=user_mail_attrib,
|
||||
manage_groups=manage_groups,
|
||||
allowed_groups=allowed_groups,
|
||||
group_mapping=group_mapping,
|
||||
db=db):
|
||||
if password == '': # http://tools.ietf.org/html/rfc4513#section-5.1.2
|
||||
logger.warning('blank password not allowed')
|
||||
@@ -265,7 +262,6 @@ def ldap_auth(server='ldap',
|
||||
requested_attrs = ['sAMAccountName']
|
||||
if manage_user:
|
||||
requested_attrs.extend([user_firstname_attrib, user_lastname_attrib, user_mail_attrib])
|
||||
|
||||
result = con.search_ext_s(
|
||||
ldap_basedn, ldap.SCOPE_SUBTREE,
|
||||
"(&(sAMAccountName=%s)(%s))" % (ldap.filter.escape_filter_chars(username_bare), filterstr),
|
||||
@@ -448,7 +444,7 @@ def ldap_auth(server='ldap',
|
||||
con.unbind()
|
||||
|
||||
if manage_groups:
|
||||
if not do_manage_groups(username, password, group_mapping):
|
||||
if not do_manage_groups(username, password):
|
||||
return False
|
||||
return True
|
||||
except ldap.INVALID_CREDENTIALS, e:
|
||||
@@ -486,7 +482,7 @@ def ldap_auth(server='ldap',
|
||||
# No match
|
||||
return False
|
||||
|
||||
def do_manage_groups(username, password=None, group_mapping={}, db=db):
|
||||
def do_manage_groups(username, password=None, db=db):
|
||||
"""
|
||||
Manage user groups
|
||||
|
||||
@@ -502,14 +498,6 @@ def ldap_auth(server='ldap',
|
||||
ldap_groups_of_the_user = get_user_groups_from_ldap(
|
||||
username, password)
|
||||
|
||||
if group_mapping != {}:
|
||||
l = []
|
||||
for group in ldap_groups_of_the_user:
|
||||
if group in group_mapping:
|
||||
l += group_mapping[group]
|
||||
ldap_groups_of_the_user = l
|
||||
logging.info("User groups after remapping: %s" % str(l))
|
||||
|
||||
#
|
||||
# Get all group name where the user is in actually in local db
|
||||
# #############################################################
|
||||
@@ -552,7 +540,6 @@ def ldap_auth(server='ldap',
|
||||
db_groups_of_the_user.append(group.role)
|
||||
logging.debug('db groups of user %s: %s' % (username, str(db_groups_of_the_user)))
|
||||
|
||||
auth_membership_changed = False
|
||||
#
|
||||
# Delete user membership from groups where user is not anymore
|
||||
# #############################################################
|
||||
@@ -560,7 +547,6 @@ def ldap_auth(server='ldap',
|
||||
if ldap_groups_of_the_user.count(group_to_del) == 0:
|
||||
db((db.auth_membership.user_id == db_user_id) &
|
||||
(db.auth_membership.group_id == db_group_id[group_to_del])).delete()
|
||||
auth_membership_changed = True
|
||||
|
||||
#
|
||||
# Create user membership in groups where user is not in already
|
||||
@@ -572,12 +558,6 @@ def ldap_auth(server='ldap',
|
||||
else:
|
||||
gid = db(db.auth_group.role == group_to_add).select(db.auth_group.id).first().id
|
||||
db.auth_membership.insert(user_id=db_user_id, group_id=gid)
|
||||
auth_membership_changed = True
|
||||
|
||||
if auth_membership_changed:
|
||||
for callback in manage_groups_callback:
|
||||
callback()
|
||||
|
||||
except:
|
||||
logger.warning("[%s] Groups are not managed successfully!" % str(username))
|
||||
import traceback
|
||||
|
||||
@@ -7,11 +7,10 @@ import re
|
||||
import urllib
|
||||
from cgi import escape
|
||||
from string import maketrans
|
||||
|
||||
try:
|
||||
from ast import parse as ast_parse
|
||||
import ast
|
||||
except ImportError: # python 2.5
|
||||
from ast import parse as ast_parse
|
||||
import ast
|
||||
except ImportError: # python 2.5
|
||||
from compiler import parse
|
||||
import compiler.ast as ast
|
||||
|
||||
@@ -531,47 +530,41 @@ As shown in Ref.!`!`mdipierro`!`!:cite
|
||||
``<ul/>``, ``<ol/>``, ``<code/>``, ``<table/>``, ``<blockquote/>``, ``<h1/>``, ..., ``<h6/>`` do not have ``<p>...</p>`` around them.
|
||||
|
||||
"""
|
||||
html_colors = ['aqua', 'black', 'blue', 'fuchsia', 'gray', 'green',
|
||||
'lime', 'maroon', 'navy', 'olive', 'purple', 'red',
|
||||
'silver', 'teal', 'white', 'yellow']
|
||||
html_colors=['aqua', 'black', 'blue', 'fuchsia', 'gray', 'green',
|
||||
'lime', 'maroon', 'navy', 'olive', 'purple', 'red',
|
||||
'silver', 'teal', 'white', 'yellow']
|
||||
|
||||
META = '\x06'
|
||||
LINK = '\x07'
|
||||
DISABLED_META = '\x08'
|
||||
LATEX = '<img src="http://chart.apis.google.com/chart?cht=tx&chl=%s" />'
|
||||
regex_URL = re.compile(r'@/(?P<a>\w*)/(?P<c>\w*)/(?P<f>\w*(\.\w+)?)(/(?P<args>[\w\.\-/]+))?')
|
||||
regex_env2 = re.compile(r'@\{(?P<a>[\w\-\.]+?)(\:(?P<b>.*?))?\}')
|
||||
regex_expand_meta = re.compile('(' + META + '|' + DISABLED_META + '|````)')
|
||||
regex_dd = re.compile(r'\$\$(?P<latex>.*?)\$\$')
|
||||
regex_code = re.compile(
|
||||
'(' + META + '|' + DISABLED_META + r'|````)|(``(?P<t>.+?)``(?::(?P<c>[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P<p>[^\]]*)\])?)?)',
|
||||
re.S)
|
||||
regex_strong = re.compile(r'\*\*(?P<t>[^\s*]+( +[^\s*]+)*)\*\*')
|
||||
regex_del = re.compile(r'~~(?P<t>[^\s*]+( +[^\s*]+)*)~~')
|
||||
regex_em = re.compile(r"''(?P<t>([^\s']| |'(?!'))+)''")
|
||||
regex_num = re.compile(r"^\s*[+-]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?[0-9]+)?\s*$")
|
||||
regex_list = re.compile('^(?:(?:(#{1,6})|(?:(\.+|\++|\-+)(\.)?))\s*)?(.*)$')
|
||||
regex_bq_headline = re.compile('^(?:(\.+|\++|\-+)(\.)?\s+)?(-{3}-*)$')
|
||||
regex_tq = re.compile('^(-{3}-*)(?::(?P<c>[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P<p>[a-zA-Z][_a-zA-Z\-\d]*)\])?)?$')
|
||||
regex_URL=re.compile(r'@/(?P<a>\w*)/(?P<c>\w*)/(?P<f>\w*(\.\w+)?)(/(?P<args>[\w\.\-/]+))?')
|
||||
regex_env2=re.compile(r'@\{(?P<a>[\w\-\.]+?)(\:(?P<b>.*?))?\}')
|
||||
regex_expand_meta = re.compile('('+META+'|'+DISABLED_META+'|````)')
|
||||
regex_dd=re.compile(r'\$\$(?P<latex>.*?)\$\$')
|
||||
regex_code = re.compile('('+META+'|'+DISABLED_META+r'|````)|(``(?P<t>.+?)``(?::(?P<c>[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P<p>[^\]]*)\])?)?)',re.S)
|
||||
regex_strong=re.compile(r'\*\*(?P<t>[^\s*]+( +[^\s*]+)*)\*\*')
|
||||
regex_del=re.compile(r'~~(?P<t>[^\s*]+( +[^\s*]+)*)~~')
|
||||
regex_em=re.compile(r"''(?P<t>([^\s']| |'(?!'))+)''")
|
||||
regex_num=re.compile(r"^\s*[+-]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?[0-9]+)?\s*$")
|
||||
regex_list=re.compile('^(?:(?:(#{1,6})|(?:(\.+|\++|\-+)(\.)?))\s*)?(.*)$')
|
||||
regex_bq_headline=re.compile('^(?:(\.+|\++|\-+)(\.)?\s+)?(-{3}-*)$')
|
||||
regex_tq=re.compile('^(-{3}-*)(?::(?P<c>[a-zA-Z][_a-zA-Z\-\d]*)(?:\[(?P<p>[a-zA-Z][_a-zA-Z\-\d]*)\])?)?$')
|
||||
regex_proto = re.compile(r'(?<!["\w>/=])(?P<p>\w+):(?P<k>\w+://[\w\d\-+=?%&/:.]+)', re.M)
|
||||
regex_auto = re.compile(r'(?<!["\w>/=])(?P<k>\w+://[\w\d\-+_=?%&/:.,;#]+\w|[\w\-.]+@[\w\-.]+)', re.M)
|
||||
regex_link = re.compile(r'(' + LINK + r')|\[\[(?P<s>.+?)\]\]', re.S)
|
||||
regex_link_level2 = re.compile(r'^(?P<t>\S.*?)?(?:\s+\[(?P<a>.+?)\])?(?:\s+(?P<k>\S+))?(?:\s+(?P<p>popup))?\s*$', re.S)
|
||||
regex_media_level2 = re.compile(
|
||||
r'^(?P<t>\S.*?)?(?:\s+\[(?P<a>.+?)\])?(?:\s+(?P<k>\S+))?\s+(?P<p>img|IMG|left|right|center|video|audio|blockleft|blockright)(?:\s+(?P<w>\d+px))?\s*$',
|
||||
re.S)
|
||||
regex_auto = re.compile(r'(?<!["\w>/=])(?P<k>\w+://[\w\d\-+_=?%&/:.,;#]+\w|[\w\-.]+@[\w\-.]+)',re.M)
|
||||
regex_link=re.compile(r'('+LINK+r')|\[\[(?P<s>.+?)\]\]',re.S)
|
||||
regex_link_level2=re.compile(r'^(?P<t>\S.*?)?(?:\s+\[(?P<a>.+?)\])?(?:\s+(?P<k>\S+))?(?:\s+(?P<p>popup))?\s*$',re.S)
|
||||
regex_media_level2=re.compile(r'^(?P<t>\S.*?)?(?:\s+\[(?P<a>.+?)\])?(?:\s+(?P<k>\S+))?\s+(?P<p>img|IMG|left|right|center|video|audio|blockleft|blockright)(?:\s+(?P<w>\d+px))?\s*$',re.S)
|
||||
|
||||
regex_markmin_escape = re.compile(r"(\\*)(['`:*~\\[\]{}@\$+\-.#\n])")
|
||||
regex_backslash = re.compile(r"\\(['`:*~\\[\]{}@\$+\-.#\n])")
|
||||
ttab_in = maketrans("'`:*~\\[]{}@$+-.#\n", '\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x05')
|
||||
ttab_out = maketrans('\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x05', "'`:*~\\[]{}@$+-.#\n")
|
||||
ttab_in = maketrans("'`:*~\\[]{}@$+-.#\n", '\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x05')
|
||||
ttab_out = maketrans('\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x05',"'`:*~\\[]{}@$+-.#\n")
|
||||
regex_quote = re.compile('(?P<name>\w+?)\s*\=\s*')
|
||||
|
||||
|
||||
def make_dict(b):
|
||||
return '{%s}' % regex_quote.sub("'\g<name>':", b)
|
||||
|
||||
|
||||
return '{%s}' % regex_quote.sub("'\g<name>':",b)
|
||||
|
||||
def safe_eval(node_or_string, env):
|
||||
"""
|
||||
Safely evaluate an expression node or a string containing a Python
|
||||
@@ -585,7 +578,6 @@ def safe_eval(node_or_string, env):
|
||||
node_or_string = ast_parse(node_or_string, mode='eval')
|
||||
if isinstance(node_or_string, ast.Expression):
|
||||
node_or_string = node_or_string.body
|
||||
|
||||
def _convert(node):
|
||||
if isinstance(node, ast.Str):
|
||||
return node.s
|
||||
@@ -602,11 +594,11 @@ def safe_eval(node_or_string, env):
|
||||
if node.id in _safe_names:
|
||||
return _safe_names[node.id]
|
||||
elif isinstance(node, ast.BinOp) and \
|
||||
isinstance(node.op, (Add, Sub)) and \
|
||||
isinstance(node.right, Num) and \
|
||||
isinstance(node.right.n, complex) and \
|
||||
isinstance(node.left, Num) and \
|
||||
isinstance(node.left.n, (int, long, float)):
|
||||
isinstance(node.op, (Add, Sub)) and \
|
||||
isinstance(node.right, Num) and \
|
||||
isinstance(node.right.n, complex) and \
|
||||
isinstance(node.left, Num) and \
|
||||
isinstance(node.left.n, (int, long, float)):
|
||||
left = node.left.n
|
||||
right = node.right.n
|
||||
if isinstance(node.op, Add):
|
||||
@@ -614,66 +606,57 @@ def safe_eval(node_or_string, env):
|
||||
else:
|
||||
return left - right
|
||||
raise ValueError('malformed string')
|
||||
|
||||
return _convert(node_or_string)
|
||||
|
||||
|
||||
def markmin_escape(text):
|
||||
""" insert \\ before markmin control characters: '`:*~[]{}@$ """
|
||||
return regex_markmin_escape.sub(
|
||||
lambda m: '\\' + m.group(0).replace('\\', '\\\\'), text)
|
||||
lambda m: '\\'+m.group(0).replace('\\','\\\\'), text)
|
||||
|
||||
|
||||
def replace_autolinks(text, autolinks):
|
||||
def replace_autolinks(text,autolinks):
|
||||
return regex_auto.sub(lambda m: autolinks(m.group('k')), text)
|
||||
|
||||
|
||||
def replace_at_urls(text, url):
|
||||
def replace_at_urls(text,url):
|
||||
# this is experimental @{function/args}
|
||||
def u1(match, url=url):
|
||||
a, c, f, args = match.group('a', 'c', 'f', 'args')
|
||||
return url(a=a or None, c=c or None, f=f or None,
|
||||
def u1(match,url=url):
|
||||
a,c,f,args = match.group('a','c','f','args')
|
||||
return url(a=a or None,c=c or None,f = f or None,
|
||||
args=(args or '').split('/'), scheme=True, host=True)
|
||||
return regex_URL.sub(u1,text)
|
||||
|
||||
return regex_URL.sub(u1, text)
|
||||
|
||||
|
||||
def replace_components(text, env):
|
||||
def replace_components(text,env):
|
||||
# not perfect but acceptable
|
||||
def u2(match, env=env):
|
||||
f = env.get(match.group('a'), match.group(0))
|
||||
if callable(f):
|
||||
b = match.group('b')
|
||||
try:
|
||||
b = safe_eval(make_dict(b), env)
|
||||
b = safe_eval(make_dict(b),env)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
f = f(**b) if isinstance(b, dict) else f(b)
|
||||
f = f(**b) if isinstance(b,dict) else f(b)
|
||||
except Exception, e:
|
||||
f = 'ERROR: %s' % e
|
||||
return str(f)
|
||||
|
||||
text = regex_env2.sub(u2, text)
|
||||
return text
|
||||
|
||||
|
||||
def autolinks_simple(url):
|
||||
"""
|
||||
it automatically converts the url to link,
|
||||
image, video or audio tag
|
||||
"""
|
||||
u_url = url.lower()
|
||||
if '@' in url and '://' not in url:
|
||||
u_url=url.lower()
|
||||
if '@' in url and not '://' in url:
|
||||
return '<a href="mailto:%s">%s</a>' % (url, url)
|
||||
elif u_url.endswith(('.jpg', '.jpeg', '.gif', '.png')):
|
||||
elif u_url.endswith(('.jpg','.jpeg','.gif','.png')):
|
||||
return '<img src="%s" controls />' % url
|
||||
elif u_url.endswith(('.mp4', '.mpeg', '.mov', '.ogv')):
|
||||
elif u_url.endswith(('.mp4','.mpeg','.mov','.ogv')):
|
||||
return '<video src="%s" controls></video>' % url
|
||||
elif u_url.endswith(('.mp3', '.wav', '.ogg')):
|
||||
elif u_url.endswith(('.mp3','.wav','.ogg')):
|
||||
return '<audio src="%s" controls></audio>' % url
|
||||
return '<a href="%s">%s</a>' % (url, url)
|
||||
|
||||
return '<a href="%s">%s</a>' % (url,url)
|
||||
|
||||
def protolinks_simple(proto, url):
|
||||
"""
|
||||
@@ -684,18 +667,16 @@ def protolinks_simple(proto, url):
|
||||
proto="iframe"
|
||||
url="http://www.example.com/path"
|
||||
"""
|
||||
if proto in ('iframe', 'embed'): # == 'iframe':
|
||||
return '<iframe src="%s" frameborder="0" allowfullscreen></iframe>' % url
|
||||
# elif proto == 'embed': # NOTE: embed is a synonym to iframe now
|
||||
if proto in ('iframe','embed'): #== 'iframe':
|
||||
return '<iframe src="%s" frameborder="0" allowfullscreen></iframe>'%url
|
||||
#elif proto == 'embed': # NOTE: embed is a synonym to iframe now
|
||||
# return '<a href="%s" class="%sembed">%s></a>'%(url,class_prefix,url)
|
||||
elif proto == 'qr':
|
||||
return '<img style="width:100px" src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=%s&choe=UTF-8&chld=H" alt="QR Code" title="QR Code" />' % url
|
||||
return proto + ':' + url
|
||||
|
||||
return '<img style="width:100px" src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=%s&choe=UTF-8&chld=H" alt="QR Code" title="QR Code" />'%url
|
||||
return proto+':'+url
|
||||
|
||||
def email_simple(email):
|
||||
return '<a href="mailto:%s">%s</a>' % (email, email)
|
||||
|
||||
return '<a href="mailto:%s">%s</a>' % (email, email)
|
||||
|
||||
def render(text,
|
||||
extra={},
|
||||
@@ -944,19 +925,17 @@ def render(text,
|
||||
>>> render("anchor with name 'NEWLINE': [[NEWLINE [newline] ]]")
|
||||
'<p>anchor with name \\'NEWLINE\\': <span class="anchor" id="markmin_NEWLINE">newline</span></p>'
|
||||
"""
|
||||
if autolinks == "default":
|
||||
autolinks = autolinks_simple
|
||||
if protolinks == "default":
|
||||
protolinks = protolinks_simple
|
||||
pp = '\n' if pretty_print else ''
|
||||
if isinstance(text, unicode):
|
||||
if autolinks=="default": autolinks = autolinks_simple
|
||||
if protolinks=="default": protolinks = protolinks_simple
|
||||
pp='\n' if pretty_print else ''
|
||||
if isinstance(text,unicode):
|
||||
text = text.encode('utf8')
|
||||
text = str(text or '')
|
||||
text = regex_backslash.sub(lambda m: m.group(1).translate(ttab_in), text)
|
||||
text = text.replace('\x05', '').replace('\r\n', '\n') # concatenate strings separeted by \\n
|
||||
text = text.replace('\x05','').replace('\r\n', '\n') # concatenate strings separeted by \\n
|
||||
|
||||
if URL is not None:
|
||||
text = replace_at_urls(text, URL)
|
||||
text = replace_at_urls(text,URL)
|
||||
|
||||
if latex == 'google':
|
||||
text = regex_dd.sub('``\g<latex>``:latex ', text)
|
||||
@@ -966,10 +945,9 @@ def render(text,
|
||||
# store them into segments they will be treated as code
|
||||
#############################################################
|
||||
segments = []
|
||||
|
||||
def mark_code(m):
|
||||
g = m.group(0)
|
||||
if g in (META, DISABLED_META):
|
||||
if g in (META, DISABLED_META ):
|
||||
segments.append((None, None, None, g))
|
||||
return m.group()
|
||||
elif g == '````':
|
||||
@@ -978,12 +956,10 @@ def render(text,
|
||||
else:
|
||||
c = m.group('c') or ''
|
||||
p = m.group('p') or ''
|
||||
if 'code' in allowed and c not in allowed['code']:
|
||||
c = ''
|
||||
code = m.group('t').replace('!`!', '`')
|
||||
if 'code' in allowed and not c in allowed['code']: c = ''
|
||||
code = m.group('t').replace('!`!','`')
|
||||
segments.append((code, c, p, m.group(0)))
|
||||
return META
|
||||
|
||||
text = regex_code.sub(mark_code, text)
|
||||
|
||||
#############################################################
|
||||
@@ -991,58 +967,56 @@ def render(text,
|
||||
# store them into links they will be treated as link
|
||||
#############################################################
|
||||
links = []
|
||||
|
||||
def mark_link(m):
|
||||
links.append(None if m.group() == LINK
|
||||
else m.group('s'))
|
||||
links.append( None if m.group() == LINK
|
||||
else m.group('s') )
|
||||
return LINK
|
||||
|
||||
text = regex_link.sub(mark_link, text)
|
||||
text = escape(text)
|
||||
|
||||
if protolinks:
|
||||
text = regex_proto.sub(lambda m: protolinks(*m.group('p', 'k')), text)
|
||||
text = regex_proto.sub(lambda m: protolinks(*m.group('p','k')), text)
|
||||
|
||||
if autolinks:
|
||||
text = replace_autolinks(text, autolinks)
|
||||
text = replace_autolinks(text,autolinks)
|
||||
|
||||
#############################################################
|
||||
# normalize spaces
|
||||
#############################################################
|
||||
strings = text.split('\n')
|
||||
strings=text.split('\n')
|
||||
|
||||
def parse_title(t, s): # out, lev, etags, tag, s):
|
||||
hlevel = str(len(t))
|
||||
def parse_title(t, s): #out, lev, etags, tag, s):
|
||||
hlevel=str(len(t))
|
||||
out.extend(etags[::-1])
|
||||
out.append("<h%s>%s" % (hlevel, s))
|
||||
etags[:] = ["</h%s>%s" % (hlevel, pp)]
|
||||
lev = 0
|
||||
ltags[:] = []
|
||||
tlev[:] = []
|
||||
out.append("<h%s>%s"%(hlevel,s))
|
||||
etags[:]=["</h%s>%s"%(hlevel,pp)]
|
||||
lev=0
|
||||
ltags[:]=[]
|
||||
tlev[:]=[]
|
||||
return (lev, 'h')
|
||||
|
||||
def parse_list(t, p, s, tag, lev, mtag, lineno):
|
||||
lent = len(t)
|
||||
if lent < lev: # current item level < previous item level
|
||||
while ltags[-1] > lent:
|
||||
lent=len(t)
|
||||
if lent<lev: # current item level < previous item level
|
||||
while ltags[-1]>lent:
|
||||
ltags.pop()
|
||||
out.append(etags.pop())
|
||||
lev = lent
|
||||
tlev[lev:] = []
|
||||
lev=lent
|
||||
tlev[lev:]=[]
|
||||
|
||||
if lent > lev: # current item level > previous item level
|
||||
if lev == 0: # previous line is not a list (paragraph or title)
|
||||
if lent>lev: # current item level > previous item level
|
||||
if lev==0: # previous line is not a list (paragraph or title)
|
||||
out.extend(etags[::-1])
|
||||
ltags[:] = []
|
||||
tlev[:] = []
|
||||
etags[:] = []
|
||||
if pend and mtag == '.': # paragraph in a list:
|
||||
ltags[:]=[]
|
||||
tlev[:]=[]
|
||||
etags[:]=[]
|
||||
if pend and mtag == '.': # paragraph in a list:
|
||||
out.append(etags.pop())
|
||||
ltags.pop()
|
||||
for i in xrange(lent - lev):
|
||||
out.append('<' + tag + '>' + pp)
|
||||
etags.append('</' + tag + '>' + pp)
|
||||
lev += 1
|
||||
for i in xrange(lent-lev):
|
||||
out.append('<'+tag+'>'+pp)
|
||||
etags.append('</'+tag+'>'+pp)
|
||||
lev+=1
|
||||
ltags.append(lev)
|
||||
tlev.append(tag)
|
||||
elif lent == lev:
|
||||
@@ -1051,22 +1025,22 @@ def render(text,
|
||||
for i in xrange(ltags.count(lent)):
|
||||
ltags.pop()
|
||||
out.append(etags.pop())
|
||||
tlev[-1] = tag
|
||||
out.append('<' + tag + '>' + pp)
|
||||
etags.append('</' + tag + '>' + pp)
|
||||
tlev[-1]=tag
|
||||
out.append('<'+tag+'>'+pp)
|
||||
etags.append('</'+tag+'>'+pp)
|
||||
ltags.append(lev)
|
||||
else:
|
||||
if ltags.count(lev) > 1:
|
||||
if ltags.count(lev)>1:
|
||||
out.append(etags.pop())
|
||||
ltags.pop()
|
||||
mtag = 'l'
|
||||
mtag='l'
|
||||
out.append('<li>')
|
||||
etags.append('</li>' + pp)
|
||||
etags.append('</li>'+pp)
|
||||
ltags.append(lev)
|
||||
if s[:1] == '-':
|
||||
(s, mtag, lineno) = parse_table_or_blockquote(s, mtag, lineno)
|
||||
if p and mtag == 'l':
|
||||
(lev, mtag, lineno) = parse_point(t, s, lev, '', lineno)
|
||||
if p and mtag=='l':
|
||||
(lev,mtag,lineno)=parse_point(t, s, lev, '', lineno)
|
||||
else:
|
||||
out.append(s)
|
||||
|
||||
@@ -1074,28 +1048,28 @@ def render(text,
|
||||
|
||||
def parse_point(t, s, lev, mtag, lineno):
|
||||
""" paragraphs in lists """
|
||||
lent = len(t)
|
||||
if lent > lev:
|
||||
lent=len(t)
|
||||
if lent>lev:
|
||||
return parse_list(t, '.', s, 'ul', lev, mtag, lineno)
|
||||
elif lent < lev:
|
||||
while ltags[-1] > lent:
|
||||
elif lent<lev:
|
||||
while ltags[-1]>lent:
|
||||
ltags.pop()
|
||||
out.append(etags.pop())
|
||||
lev = lent
|
||||
tlev[lev:] = []
|
||||
mtag = ''
|
||||
elif lent == lev:
|
||||
lev=lent
|
||||
tlev[lev:]=[]
|
||||
mtag=''
|
||||
elif lent==lev:
|
||||
if pend and mtag == '.':
|
||||
out.append(etags.pop())
|
||||
ltags.pop()
|
||||
if br and mtag in ('l', '.'):
|
||||
if br and mtag in ('l','.'):
|
||||
out.append(br)
|
||||
if s == META:
|
||||
mtag = ''
|
||||
mtag = ''
|
||||
else:
|
||||
mtag = '.'
|
||||
if s[:1] == '-':
|
||||
(s, mtag, lineno) = parse_table_or_blockquote(s, mtag, lineno)
|
||||
(s, mtag, lineno) = parse_table_or_blockquote(s, mtag, lineno)
|
||||
if mtag == '.':
|
||||
out.append(pbeg)
|
||||
if pend:
|
||||
@@ -1109,19 +1083,19 @@ def render(text,
|
||||
# - is empty -> this is an <hr /> tag
|
||||
# - consists '|' -> table
|
||||
# - consists other characters -> blockquote
|
||||
if (lineno + 1 >= strings_len or
|
||||
not (s.count('-') == len(s) and len(s) > 3)):
|
||||
return (s, mtag, lineno)
|
||||
if (lineno+1 >= strings_len or
|
||||
not(s.count('-') == len(s) and len(s)>3)):
|
||||
return (s, mtag, lineno)
|
||||
|
||||
lineno += 1
|
||||
lineno+=1
|
||||
s = strings[lineno].strip()
|
||||
if s:
|
||||
if '|' in s:
|
||||
# table
|
||||
tout = []
|
||||
thead = []
|
||||
tbody = []
|
||||
rownum = 0
|
||||
tout=[]
|
||||
thead=[]
|
||||
tbody=[]
|
||||
rownum=0
|
||||
t_id = ''
|
||||
t_cls = ''
|
||||
|
||||
@@ -1130,14 +1104,14 @@ def render(text,
|
||||
s = strings[lineno].strip()
|
||||
if s[:1] == '=':
|
||||
# header or footer
|
||||
if s.count('=') == len(s) and len(s) > 3:
|
||||
if not thead: # if thead list is empty:
|
||||
if s.count('=')==len(s) and len(s)>3:
|
||||
if not thead: # if thead list is empty:
|
||||
thead = tout
|
||||
else:
|
||||
tbody.extend(tout)
|
||||
tout = []
|
||||
rownum = 0
|
||||
lineno += 1
|
||||
rownum=0
|
||||
lineno+=1
|
||||
continue
|
||||
|
||||
m = regex_tq.match(s)
|
||||
@@ -1147,36 +1121,36 @@ def render(text,
|
||||
break
|
||||
|
||||
if rownum % 2:
|
||||
tr = '<tr class="even">'
|
||||
tr = '<tr class="even">'
|
||||
else:
|
||||
tr = '<tr class="first">' if rownum == 0 else '<tr>'
|
||||
tr = '<tr class="first">' if rownum == 0 else '<tr>'
|
||||
tout.append(tr + ''.join(['<td%s>%s</td>' % (
|
||||
' class="num"'
|
||||
if regex_num.match(f) else '',
|
||||
f.strip()
|
||||
) for f in s.split('|')]) + '</tr>' + pp)
|
||||
rownum += 1
|
||||
lineno += 1
|
||||
' class="num"'
|
||||
if regex_num.match(f) else '',
|
||||
f.strip()
|
||||
) for f in s.split('|')])+'</tr>'+pp)
|
||||
rownum+=1
|
||||
lineno+=1
|
||||
|
||||
t_cls = ' class="%s%s"' % (class_prefix, t_cls) \
|
||||
t_cls = ' class="%s%s"'%(class_prefix, t_cls) \
|
||||
if t_cls and t_cls != 'id' else ''
|
||||
t_id = ' id="%s%s"' % (id_prefix, t_id) if t_id else ''
|
||||
t_id = ' id="%s%s"'%(id_prefix, t_id) if t_id else ''
|
||||
s = ''
|
||||
if thead:
|
||||
s += '<thead>' + pp + ''.join([l for l in thead]) + '</thead>' + pp
|
||||
if not tbody: # tbody strings are in tout list
|
||||
s += '<thead>'+pp+''.join([l for l in thead])+'</thead>'+pp
|
||||
if not tbody: # tbody strings are in tout list
|
||||
tbody = tout
|
||||
tout = []
|
||||
if tbody: # if tbody list is not empty:
|
||||
s += '<tbody>' + pp + ''.join([l for l in tbody]) + '</tbody>' + pp
|
||||
if tout: # tfoot is not empty:
|
||||
s += '<tfoot>' + pp + ''.join([l for l in tout]) + '</tfoot>' + pp
|
||||
if tbody: # if tbody list is not empty:
|
||||
s += '<tbody>'+pp+''.join([l for l in tbody])+'</tbody>'+pp
|
||||
if tout: # tfoot is not empty:
|
||||
s += '<tfoot>'+pp+''.join([l for l in tout])+'</tfoot>'+pp
|
||||
s = '<table%s%s>%s%s</table>%s' % (t_cls, t_id, pp, s, pp)
|
||||
mtag = 't'
|
||||
mtag='t'
|
||||
else:
|
||||
# parse blockquote:
|
||||
bq_begin = lineno
|
||||
t_mode = False # embedded table
|
||||
bq_begin=lineno
|
||||
t_mode = False # embedded table
|
||||
t_cls = ''
|
||||
t_id = ''
|
||||
|
||||
@@ -1186,57 +1160,57 @@ def render(text,
|
||||
if not t_mode:
|
||||
m = regex_tq.match(s)
|
||||
if m:
|
||||
if (lineno + 1 == strings_len or
|
||||
'|' not in strings[lineno + 1]):
|
||||
t_cls = m.group('c') or ''
|
||||
t_id = m.group('p') or ''
|
||||
break
|
||||
if (lineno+1 == strings_len or
|
||||
'|' not in strings[lineno+1]):
|
||||
t_cls = m.group('c') or ''
|
||||
t_id = m.group('p') or ''
|
||||
break
|
||||
|
||||
if regex_bq_headline.match(s):
|
||||
if (lineno + 1 < strings_len and
|
||||
strings[lineno + 1].strip()):
|
||||
t_mode = True
|
||||
lineno += 1
|
||||
if (lineno+1 < strings_len and
|
||||
strings[lineno+1].strip()):
|
||||
t_mode = True
|
||||
lineno+=1
|
||||
continue
|
||||
elif regex_tq.match(s):
|
||||
t_mode = False
|
||||
lineno += 1
|
||||
t_mode=False
|
||||
lineno+=1
|
||||
continue
|
||||
|
||||
lineno += 1
|
||||
lineno+=1
|
||||
|
||||
t_cls = ' class="%s%s"' % (class_prefix, t_cls) \
|
||||
t_cls = ' class="%s%s"'%(class_prefix,t_cls) \
|
||||
if t_cls and t_cls != 'id' else ''
|
||||
t_id = ' id="%s%s"' % (id_prefix, t_id) \
|
||||
t_id = ' id="%s%s"'%(id_prefix,t_id) \
|
||||
if t_id else ''
|
||||
|
||||
|
||||
s = '<blockquote%s%s>%s</blockquote>%s' \
|
||||
% (t_cls,
|
||||
t_id,
|
||||
'\n'.join(strings[bq_begin:lineno]), pp)
|
||||
mtag = 'q'
|
||||
% (t_cls,
|
||||
t_id,
|
||||
'\n'.join(strings[bq_begin:lineno]),pp)
|
||||
mtag='q'
|
||||
else:
|
||||
s = '<hr />'
|
||||
lineno -= 1
|
||||
mtag = 'q'
|
||||
lineno-=1
|
||||
mtag='q'
|
||||
return (s, 'q', lineno)
|
||||
|
||||
if sep == 'p':
|
||||
pbeg = "<p>"
|
||||
pend = "</p>" + pp
|
||||
br = ''
|
||||
pbeg = "<p>"
|
||||
pend = "</p>"+pp
|
||||
br = ''
|
||||
else:
|
||||
pbeg = pend = ''
|
||||
br = "<br />" + pp if sep == 'br' else ''
|
||||
pbeg = pend = ''
|
||||
br = "<br />"+pp if sep=='br' else ''
|
||||
|
||||
lev = 0 # nesting level of lists
|
||||
c0 = '' # first character of current line
|
||||
out = [] # list of processed lines
|
||||
etags = [] # trailing tags
|
||||
ltags = [] # level# correspondent to trailing tag
|
||||
lev = 0 # nesting level of lists
|
||||
c0 = '' # first character of current line
|
||||
out = [] # list of processed lines
|
||||
etags = [] # trailing tags
|
||||
ltags = [] # level# correspondent to trailing tag
|
||||
tlev = [] # list of tags for each level ('ul' or 'ol')
|
||||
mtag = '' # marked tag (~last tag) ('l','.','h','p','t'). Used to set <br/>
|
||||
# and to avoid <p></p> around tables and blockquotes
|
||||
# and to avoid <p></p> around tables and blockquotes
|
||||
lineno = 0
|
||||
strings_len = len(strings)
|
||||
while lineno < strings_len:
|
||||
@@ -1248,67 +1222,65 @@ def render(text,
|
||||
#### ++++ ---- .... ------- field | field | field <-body
|
||||
##### +++++ ----- ..... ---------------------:class[id]
|
||||
"""
|
||||
pc0 = c0 # first character of previous line
|
||||
c0 = s[:1]
|
||||
if c0: # for non empty strings
|
||||
if c0 in "#+-.": # first character is one of: # + - .
|
||||
(t1, t2, p, ss) = regex_list.findall(s)[0]
|
||||
pc0=c0 # first character of previous line
|
||||
c0=s[:1]
|
||||
if c0: # for non empty strings
|
||||
if c0 in "#+-.": # first character is one of: # + - .
|
||||
(t1,t2,p,ss) = regex_list.findall(s)[0]
|
||||
# t1 - tag ("###")
|
||||
# t2 - tag ("+++", "---", "...")
|
||||
# p - paragraph point ('.')->for "++." or "--."
|
||||
# ss - other part of string
|
||||
if t1 or t2:
|
||||
# headers and lists:
|
||||
if c0 == '#': # headers
|
||||
if c0 == '#': # headers
|
||||
(lev, mtag) = parse_title(t1, ss)
|
||||
lineno += 1
|
||||
lineno+=1
|
||||
continue
|
||||
elif c0 == '+': # ordered list
|
||||
(lev, mtag, lineno) = parse_list(t2, p, ss, 'ol', lev, mtag, lineno)
|
||||
lineno += 1
|
||||
elif c0 == '+': # ordered list
|
||||
(lev, mtag, lineno)= parse_list(t2, p, ss, 'ol', lev, mtag, lineno)
|
||||
lineno+=1
|
||||
continue
|
||||
elif c0 == '-': # unordered list, table or blockquote
|
||||
elif c0 == '-': # unordered list, table or blockquote
|
||||
if p or ss:
|
||||
(lev, mtag, lineno) = parse_list(t2, p, ss, 'ul', lev, mtag, lineno)
|
||||
lineno += 1
|
||||
lineno+=1
|
||||
continue
|
||||
else:
|
||||
(s, mtag, lineno) = parse_table_or_blockquote(s, mtag, lineno)
|
||||
elif lev > 0: # and c0 == '.' # paragraph in lists
|
||||
elif lev>0: # and c0 == '.' # paragraph in lists
|
||||
(lev, mtag, lineno) = parse_point(t2, ss, lev, mtag, lineno)
|
||||
lineno += 1
|
||||
lineno+=1
|
||||
continue
|
||||
|
||||
if lev == 0 and (mtag == 'q' or s == META):
|
||||
# new paragraph
|
||||
pc0 = ''
|
||||
pc0=''
|
||||
|
||||
if pc0 == '' or (mtag != 'p' and s0 not in (' ', '\t')):
|
||||
if pc0 == '' or (mtag != 'p' and s0 not in (' ','\t')):
|
||||
# paragraph
|
||||
out.extend(etags[::-1])
|
||||
etags = []
|
||||
ltags = []
|
||||
tlev = []
|
||||
lev = 0
|
||||
if br and mtag == 'p':
|
||||
out.append(br)
|
||||
etags=[]
|
||||
ltags=[]
|
||||
tlev=[]
|
||||
lev=0
|
||||
if br and mtag == 'p': out.append(br)
|
||||
if mtag != 'q' and s != META:
|
||||
if pend:
|
||||
etags = [pend]
|
||||
out.append(pbeg)
|
||||
mtag = 'p'
|
||||
if pend: etags=[pend]
|
||||
out.append(pbeg)
|
||||
mtag = 'p'
|
||||
else:
|
||||
mtag = ''
|
||||
mtag = ''
|
||||
out.append(s)
|
||||
else:
|
||||
if lev > 0 and mtag == '.' and s == META:
|
||||
if lev>0 and mtag=='.' and s == META:
|
||||
out.append(etags.pop())
|
||||
ltags.pop()
|
||||
out.append(s)
|
||||
mtag = ''
|
||||
else:
|
||||
out.append(' ' + s)
|
||||
lineno += 1
|
||||
out.append(' '+s)
|
||||
lineno+=1
|
||||
out.extend(etags[::-1])
|
||||
text = ''.join(out)
|
||||
|
||||
@@ -1323,7 +1295,7 @@ def render(text,
|
||||
# deal with images, videos, audios and links
|
||||
#############################################################
|
||||
def sub_media(m):
|
||||
t, a, k, p, w = m.group('t', 'a', 'k', 'p', 'w')
|
||||
t,a,k,p,w = m.group('t','a','k','p','w')
|
||||
if not k:
|
||||
return m.group(0)
|
||||
k = escape(k)
|
||||
@@ -1333,40 +1305,40 @@ def render(text,
|
||||
p_begin = p_end = ''
|
||||
if p == 'center':
|
||||
p_begin = '<p style="text-align:center">'
|
||||
p_end = '</p>' + pp
|
||||
p_end = '</p>'+pp
|
||||
elif p == 'blockleft':
|
||||
p_begin = '<p style="text-align:left">'
|
||||
p_end = '</p>' + pp
|
||||
p_end = '</p>'+pp
|
||||
elif p == 'blockright':
|
||||
p_begin = '<p style="text-align:right">'
|
||||
p_end = '</p>' + pp
|
||||
elif p in ('left', 'right'):
|
||||
style = ('float:%s' % p) + (';%s' % style if style else '')
|
||||
p_end = '</p>'+pp
|
||||
elif p in ('left','right'):
|
||||
style = ('float:%s' % p)+(';%s' % style if style else '')
|
||||
if t and regex_auto.match(t):
|
||||
p_begin = p_begin + '<a href="%s">' % t
|
||||
p_end = '</a>' + p_end
|
||||
t = ''
|
||||
if style:
|
||||
style = ' style="%s"' % style
|
||||
if p in ('video', 'audio'):
|
||||
if p in ('video','audio'):
|
||||
t = render(t, {}, {}, 'br', URL, environment, latex,
|
||||
autolinks, protolinks, class_prefix, id_prefix, pretty_print)
|
||||
return '<%(p)s controls="controls"%(title)s%(style)s><source src="%(k)s" />%(t)s</%(p)s>' \
|
||||
% dict(p=p, title=title, style=style, k=k, t=t)
|
||||
alt = ' alt="%s"' % escape(t).replace(META, DISABLED_META) if t else ''
|
||||
% dict(p=p, title=title, style=style, k=k, t=t)
|
||||
alt = ' alt="%s"'%escape(t).replace(META, DISABLED_META) if t else ''
|
||||
return '%(begin)s<img src="%(k)s"%(alt)s%(title)s%(style)s />%(end)s' \
|
||||
% dict(begin=p_begin, k=k, alt=alt, title=title, style=style, end=p_end)
|
||||
% dict(begin=p_begin, k=k, alt=alt, title=title, style=style, end=p_end)
|
||||
|
||||
def sub_link(m):
|
||||
t, a, k, p = m.group('t', 'a', 'k', 'p')
|
||||
t,a,k,p = m.group('t','a','k','p')
|
||||
if not k and not t:
|
||||
return m.group(0)
|
||||
t = t or ''
|
||||
a = escape(a) if a else ''
|
||||
if k:
|
||||
if '#' in k and ':' not in k.split('#')[0]:
|
||||
if '#' in k and not ':' in k.split('#')[0]:
|
||||
# wikipage, not external url
|
||||
k = k.replace('#', '#' + id_prefix)
|
||||
k=k.replace('#','#'+id_prefix)
|
||||
k = escape(k)
|
||||
title = ' title="%s"' % a.replace(META, DISABLED_META) if a else ''
|
||||
target = ' target="_blank"' if p == 'popup' else ''
|
||||
@@ -1375,18 +1347,18 @@ def render(text,
|
||||
return '<a href="%(k)s"%(title)s%(target)s>%(t)s</a>' \
|
||||
% dict(k=k, title=title, target=target, t=t)
|
||||
if t == 'NEWLINE' and not a:
|
||||
return '<br />' + pp
|
||||
return '<br />'+pp
|
||||
return '<span class="anchor" id="%s">%s</span>' % (
|
||||
escape(id_prefix + t),
|
||||
render(a, {}, {}, 'br', URL,
|
||||
escape(id_prefix+t),
|
||||
render(a, {},{},'br', URL,
|
||||
environment, latex, autolinks,
|
||||
protolinks, class_prefix,
|
||||
id_prefix, pretty_print))
|
||||
|
||||
|
||||
parts = text.split(LINK)
|
||||
text = parts[0]
|
||||
for i, s in enumerate(links):
|
||||
if s is None:
|
||||
for i,s in enumerate(links):
|
||||
if s == None:
|
||||
html = LINK
|
||||
else:
|
||||
html = regex_media_level2.sub(sub_media, s)
|
||||
@@ -1394,53 +1366,51 @@ def render(text,
|
||||
html = regex_link_level2.sub(sub_link, html)
|
||||
if html == s:
|
||||
# return unprocessed string as a signal of an error
|
||||
html = '[[%s]]' % s
|
||||
text += html + parts[i + 1]
|
||||
html = '[[%s]]'%s
|
||||
text += html + parts[i+1]
|
||||
|
||||
#############################################################
|
||||
# process all code text
|
||||
#############################################################
|
||||
def expand_meta(m):
|
||||
code, b, p, s = segments.pop(0)
|
||||
if code is None or m.group() == DISABLED_META:
|
||||
code,b,p,s = segments.pop(0)
|
||||
if code==None or m.group() == DISABLED_META:
|
||||
return escape(s)
|
||||
if b in extra:
|
||||
if code[:1] == '\n':
|
||||
code = code[1:]
|
||||
if code[-1:] == '\n':
|
||||
code = code[:-1]
|
||||
if code[:1]=='\n': code=code[1:]
|
||||
if code[-1:]=='\n': code=code[:-1]
|
||||
if p:
|
||||
return str(extra[b](code, p))
|
||||
return str(extra[b](code,p))
|
||||
else:
|
||||
return str(extra[b](code))
|
||||
elif b == 'cite':
|
||||
return '[' + ','.join('<a href="#%s" class="%s">%s</a>' %
|
||||
(id_prefix + d, b, d) for d in escape(code).split(',')) + ']'
|
||||
elif b == 'latex':
|
||||
elif b=='cite':
|
||||
return '['+','.join('<a href="#%s" class="%s">%s</a>' \
|
||||
% (id_prefix+d,b,d) \
|
||||
for d in escape(code).split(','))+']'
|
||||
elif b=='latex':
|
||||
return LATEX % urllib.quote(code)
|
||||
elif b in html_colors:
|
||||
return '<span style="color: %s">%s</span>' \
|
||||
% (b, render(code, {}, {}, 'br', URL, environment, latex,
|
||||
autolinks, protolinks, class_prefix, id_prefix, pretty_print))
|
||||
% (b, render(code, {}, {}, 'br', URL, environment, latex,
|
||||
autolinks, protolinks, class_prefix, id_prefix, pretty_print))
|
||||
elif b in ('c', 'color') and p:
|
||||
c = p.split(':')
|
||||
fg = 'color: %s;' % c[0] if c[0] else ''
|
||||
bg = 'background-color: %s;' % c[1] if len(c) > 1 and c[1] else ''
|
||||
return '<span style="%s%s">%s</span>' \
|
||||
% (fg, bg, render(code, {}, {}, 'br', URL, environment, latex,
|
||||
autolinks, protolinks, class_prefix, id_prefix, pretty_print))
|
||||
cls = ' class="%s%s"' % (class_prefix, b) if b and b != 'id' else ''
|
||||
id = ' id="%s%s"' % (id_prefix, escape(p)) if p else ''
|
||||
beg = (code[:1] == '\n')
|
||||
end = [None, -1][code[-1:] == '\n']
|
||||
c=p.split(':')
|
||||
fg='color: %s;' % c[0] if c[0] else ''
|
||||
bg='background-color: %s;' % c[1] if len(c)>1 and c[1] else ''
|
||||
return '<span style="%s%s">%s</span>' \
|
||||
% (fg, bg, render(code, {}, {}, 'br', URL, environment, latex,
|
||||
autolinks, protolinks, class_prefix, id_prefix, pretty_print))
|
||||
cls = ' class="%s%s"'%(class_prefix,b) if b and b != 'id' else ''
|
||||
id = ' id="%s%s"'%(id_prefix,escape(p)) if p else ''
|
||||
beg=(code[:1]=='\n')
|
||||
end=[None,-1][code[-1:]=='\n']
|
||||
if beg and end:
|
||||
return '<pre><code%s%s>%s</code></pre>%s' % (cls, id, escape(code[1:-1]), pp)
|
||||
return '<code%s%s>%s</code>' % (cls, id, escape(code[beg:end]))
|
||||
|
||||
text = regex_expand_meta.sub(expand_meta, text)
|
||||
|
||||
if environment:
|
||||
text = replace_components(text, environment)
|
||||
text = replace_components(text,environment)
|
||||
|
||||
return text.translate(ttab_out)
|
||||
|
||||
@@ -1453,18 +1423,16 @@ def markmin2html(text, extra={}, allowed={}, sep='p',
|
||||
class_prefix=class_prefix, id_prefix=id_prefix,
|
||||
pretty_print=pretty_print)
|
||||
|
||||
|
||||
def run_doctests():
|
||||
import doctest
|
||||
doctest.testmod()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import doctest
|
||||
from textwrap import dedent
|
||||
|
||||
html = dedent("""
|
||||
html=dedent("""
|
||||
<!doctype html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
@@ -1478,7 +1446,7 @@ if __name__ == '__main__':
|
||||
</html>""")[1:]
|
||||
|
||||
if sys.argv[1:2] == ['-h']:
|
||||
style = dedent("""
|
||||
style=dedent("""
|
||||
<style>
|
||||
blockquote { background-color: #FFFAAE; padding: 7px; }
|
||||
table { border-collapse: collapse; }
|
||||
@@ -1499,23 +1467,22 @@ if __name__ == '__main__':
|
||||
body=markmin2html(__doc__, pretty_print=True))
|
||||
elif sys.argv[1:2] == ['-t']:
|
||||
from timeit import Timer
|
||||
|
||||
loops = 1000
|
||||
ts = Timer("markmin2html(__doc__)", "from markmin2html import markmin2html")
|
||||
loops=1000
|
||||
ts = Timer("markmin2html(__doc__)","from markmin2html import markmin2html")
|
||||
print 'timeit "markmin2html(__doc__)":'
|
||||
t = min([ts.timeit(loops) for i in range(3)])
|
||||
print "%s loops, best of 3: %.3f ms per loop" % (loops, t / 1000 * loops)
|
||||
print "%s loops, best of 3: %.3f ms per loop" % (loops, t/1000*loops)
|
||||
elif len(sys.argv) > 1:
|
||||
fargv = open(sys.argv[1], 'r')
|
||||
fargv = open(sys.argv[1],'r')
|
||||
try:
|
||||
markmin_text = fargv.read()
|
||||
markmin_text=fargv.read()
|
||||
|
||||
# embed css file from second parameter into html file
|
||||
if len(sys.argv) > 2:
|
||||
if sys.argv[2].startswith('@'):
|
||||
markmin_style = '<link rel="stylesheet" href="' + sys.argv[2][1:] + '"/>'
|
||||
markmin_style = '<link rel="stylesheet" href="'+sys.argv[2][1:]+'"/>'
|
||||
else:
|
||||
fargv2 = open(sys.argv[2], 'r')
|
||||
fargv2 = open(sys.argv[2],'r')
|
||||
try:
|
||||
markmin_style = "<style>\n" + fargv2.read() + "</style>"
|
||||
finally:
|
||||
@@ -1529,9 +1496,10 @@ if __name__ == '__main__':
|
||||
fargv.close()
|
||||
|
||||
else:
|
||||
print "Usage: " + sys.argv[0] + " -h | -t | file.markmin [file.css|@path_to/css]"
|
||||
print "Usage: "+sys.argv[0]+" -h | -t | file.markmin [file.css|@path_to/css]"
|
||||
print "where: -h - print __doc__"
|
||||
print " -t - timeit __doc__ (for testing purpuse only)"
|
||||
print " file.markmin [file.css] - process file.markmin + built in file.css (optional)"
|
||||
print " file.markmin [@path_to/css] - process file.markmin + link path_to/css (optional)"
|
||||
run_doctests()
|
||||
|
||||
|
||||
@@ -7,57 +7,53 @@ import sys
|
||||
import doctest
|
||||
from optparse import OptionParser
|
||||
|
||||
__all__ = ['render', 'markmin2latex']
|
||||
__all__ = ['render','markmin2latex']
|
||||
|
||||
META = 'META'
|
||||
regex_newlines = re.compile('(\n\r)|(\r\n)')
|
||||
regex_dd = re.compile('\$\$(?P<latex>.*?)\$\$')
|
||||
regex_code = re.compile('(' + META + ')|(``(?P<t>.*?)``(:(?P<c>\w+))?)', re.S)
|
||||
regex_title = re.compile('^#{1} (?P<t>[^\n]+)', re.M)
|
||||
regex_dd=re.compile('\$\$(?P<latex>.*?)\$\$')
|
||||
regex_code = re.compile('('+META+')|(``(?P<t>.*?)``(:(?P<c>\w+))?)',re.S)
|
||||
regex_title = re.compile('^#{1} (?P<t>[^\n]+)',re.M)
|
||||
regex_maps = [
|
||||
(re.compile('[ \t\r]+\n'), '\n'),
|
||||
(re.compile('\*\*(?P<t>[^\s\*]+( +[^\s\*]+)*)\*\*'), '{\\\\bf \g<t>}'),
|
||||
(re.compile("''(?P<t>[^\s']+( +[^\s']+)*)''"), '{\\it \g<t>}'),
|
||||
(re.compile('^#{5,6}\s*(?P<t>[^\n]+)', re.M), '\n\n{\\\\bf \g<t>}\n'),
|
||||
(re.compile('^#{4}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\subsubsection{\g<t>}\n'),
|
||||
(re.compile('^#{3}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\subsection{\g<t>}\n'),
|
||||
(re.compile('^#{2}\s*(?P<t>[^\n]+)', re.M), '\n\n\\\\goodbreak\\section{\g<t>}\n'),
|
||||
(re.compile('^#{1}\s*(?P<t>[^\n]+)', re.M), ''),
|
||||
(re.compile('^\- +(?P<t>.*)', re.M), '\\\\begin{itemize}\n\\item \g<t>\n\\end{itemize}'),
|
||||
(re.compile('^\+ +(?P<t>.*)', re.M), '\\\\begin{itemize}\n\\item \g<t>\n\\end{itemize}'),
|
||||
(re.compile('\\\\end\{itemize\}\s+\\\\begin\{itemize\}'), '\n'),
|
||||
(re.compile('\n\s+\n'), '\n\n')]
|
||||
regex_table = re.compile('^\-{4,}\n(?P<t>.*?)\n\-{4,}(:(?P<c>\w+))?\n', re.M | re.S)
|
||||
(re.compile('[ \t\r]+\n'),'\n'),
|
||||
(re.compile('\*\*(?P<t>[^\s\*]+( +[^\s\*]+)*)\*\*'),'{\\\\bf \g<t>}'),
|
||||
(re.compile("''(?P<t>[^\s']+( +[^\s']+)*)''"),'{\\it \g<t>}'),
|
||||
(re.compile('^#{5,6}\s*(?P<t>[^\n]+)',re.M),'\n\n{\\\\bf \g<t>}\n'),
|
||||
(re.compile('^#{4}\s*(?P<t>[^\n]+)',re.M),'\n\n\\\\goodbreak\\subsubsection{\g<t>}\n'),
|
||||
(re.compile('^#{3}\s*(?P<t>[^\n]+)',re.M),'\n\n\\\\goodbreak\\subsection{\g<t>}\n'),
|
||||
(re.compile('^#{2}\s*(?P<t>[^\n]+)',re.M),'\n\n\\\\goodbreak\\section{\g<t>}\n'),
|
||||
(re.compile('^#{1}\s*(?P<t>[^\n]+)',re.M),''),
|
||||
(re.compile('^\- +(?P<t>.*)',re.M),'\\\\begin{itemize}\n\\item \g<t>\n\\end{itemize}'),
|
||||
(re.compile('^\+ +(?P<t>.*)',re.M),'\\\\begin{itemize}\n\\item \g<t>\n\\end{itemize}'),
|
||||
(re.compile('\\\\end\{itemize\}\s+\\\\begin\{itemize\}'),'\n'),
|
||||
(re.compile('\n\s+\n'),'\n\n')]
|
||||
regex_table = re.compile('^\-{4,}\n(?P<t>.*?)\n\-{4,}(:(?P<c>\w+))?\n',re.M|re.S)
|
||||
|
||||
regex_anchor = re.compile('\[\[(?P<t>\S+)\]\]')
|
||||
regex_bibitem = re.compile('\-\s*\[\[(?P<t>\S+)\]\]')
|
||||
regex_image_width = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+) +(?P<p>left|right|center) +(?P<w>\d+px)\]\]')
|
||||
regex_image = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+) +(?P<p>left|right|center)\]\]')
|
||||
# regex_video = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+) +video\]\]')
|
||||
# regex_audio = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+) +audio\]\]')
|
||||
#regex_video = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+) +video\]\]')
|
||||
#regex_audio = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+) +audio\]\]')
|
||||
regex_link = re.compile('\[\[(?P<t>[^\]]*?) +(?P<k>\S+)\]\]')
|
||||
regex_auto = re.compile('(?<!["\w])(?P<k>\w+://[\w\.\-\?&%\:]+)', re.M)
|
||||
regex_auto = re.compile('(?<!["\w])(?P<k>\w+://[\w\.\-\?&%\:]+)',re.M)
|
||||
regex_commas = re.compile('[ ]+(?P<t>[,;\.])')
|
||||
regex_noindent = re.compile('\n\n(?P<t>[a-z])')
|
||||
#regex_quote_left = re.compile('"(?=\w)')
|
||||
#regex_quote_right = re.compile('(?=\w\.)"')
|
||||
|
||||
|
||||
# regex_quote_left = re.compile('"(?=\w)')
|
||||
# regex_quote_right = re.compile('(?=\w\.)"')
|
||||
|
||||
def latex_escape(text, pound=True):
|
||||
text = text.replace('\\', '{\\textbackslash}')
|
||||
for c in '^_&$%{}':
|
||||
text = text.replace(c, '\\' + c)
|
||||
text = text.replace('\\{\\textbackslash\\}', '{\\textbackslash}')
|
||||
if pound: text = text.replace('#', '\\#')
|
||||
def latex_escape(text,pound=True):
|
||||
text=text.replace('\\','{\\textbackslash}')
|
||||
for c in '^_&$%{}': text=text.replace(c,'\\'+c)
|
||||
text=text.replace('\\{\\textbackslash\\}','{\\textbackslash}')
|
||||
if pound: text=text.replace('#','\\#')
|
||||
return text
|
||||
|
||||
|
||||
def render(text,
|
||||
extra={},
|
||||
allowed={},
|
||||
sep='p',
|
||||
image_mapper=lambda x: x,
|
||||
image_mapper=lambda x:x,
|
||||
chapters=False):
|
||||
#############################################################
|
||||
# replace all blocks marked with ``...``:class with META
|
||||
@@ -65,68 +61,62 @@ def render(text,
|
||||
#############################################################
|
||||
text = str(text or '')
|
||||
segments, i = [], 0
|
||||
text = regex_dd.sub('``\g<latex>``:latex ', text)
|
||||
text = regex_newlines.sub('\n', text)
|
||||
text = regex_dd.sub('``\g<latex>``:latex ',text)
|
||||
text = regex_newlines.sub('\n',text)
|
||||
while True:
|
||||
item = regex_code.search(text, i)
|
||||
if not item:
|
||||
break
|
||||
if item.group() == META:
|
||||
segments.append((None, None))
|
||||
text = text[:item.start()] + META + text[item.end():]
|
||||
item = regex_code.search(text,i)
|
||||
if not item: break
|
||||
if item.group()==META:
|
||||
segments.append((None,None))
|
||||
text = text[:item.start()]+META+text[item.end():]
|
||||
else:
|
||||
c = item.group('c') or ''
|
||||
if 'code' in allowed and c not in allowed['code']:
|
||||
c = ''
|
||||
code = item.group('t').replace('!`!', '`')
|
||||
segments.append((code, c))
|
||||
text = text[:item.start()] + META + text[item.end():]
|
||||
i = item.start() + 3
|
||||
if 'code' in allowed and not c in allowed['code']: c = ''
|
||||
code = item.group('t').replace('!`!','`')
|
||||
segments.append((code,c))
|
||||
text = text[:item.start()]+META+text[item.end():]
|
||||
i=item.start()+3
|
||||
|
||||
|
||||
#############################################################
|
||||
# do h1,h2,h3,h4,h5,h6,b,i,ol,ul and normalize spaces
|
||||
#############################################################
|
||||
|
||||
title = regex_title.search(text)
|
||||
if not title:
|
||||
title = 'Title'
|
||||
else:
|
||||
title = title.group('t')
|
||||
if not title: title='Title'
|
||||
else: title=title.group('t')
|
||||
|
||||
text = latex_escape(text, pound=False)
|
||||
text = latex_escape(text,pound=False)
|
||||
|
||||
texts = text.split('## References', 1)
|
||||
texts = text.split('## References',1)
|
||||
text = regex_anchor.sub('\\label{\g<t>}', texts[0])
|
||||
if len(texts) == 2:
|
||||
if len(texts)==2:
|
||||
text += '\n\\begin{thebibliography}{999}\n'
|
||||
text += regex_bibitem.sub('\n\\\\bibitem{\g<t>}', texts[1])
|
||||
text += '\n\\end{thebibliography}\n'
|
||||
|
||||
text = '\n'.join(t.strip() for t in text.split('\n'))
|
||||
for regex, sub in regex_maps:
|
||||
text = regex.sub(sub, text)
|
||||
text = text.replace('#', '\\#')
|
||||
text = text.replace('`', "'")
|
||||
text = regex.sub(sub,text)
|
||||
text=text.replace('#','\\#')
|
||||
text=text.replace('`',"'")
|
||||
|
||||
#############################################################
|
||||
# process tables and blockquotes
|
||||
#############################################################
|
||||
while True:
|
||||
item = regex_table.search(text)
|
||||
if not item:
|
||||
break
|
||||
if not item: break
|
||||
c = item.group('c') or ''
|
||||
if 'table' in allowed and c not in allowed['table']:
|
||||
c = ''
|
||||
if 'table' in allowed and not c in allowed['table']: c = ''
|
||||
content = item.group('t')
|
||||
if ' | ' in content:
|
||||
rows = content.replace('\n', '\\\\\n').replace(' | ', ' & ')
|
||||
row0, row2 = rows.split('\\\\\n', 1)
|
||||
cols = row0.count(' & ') + 1
|
||||
cal = '{' + ''.join('l' for j in range(cols)) + '}'
|
||||
tabular = '\\begin{center}\n{\\begin{tabular}' + cal + '\\hline\n' + row0 + '\\\\ \\hline\n' + row2 + ' \\\\ \\hline\n\\end{tabular}}\n\\end{center}'
|
||||
if row2.count('\n') > 20:
|
||||
tabular = '\\newpage\n' + tabular
|
||||
rows = content.replace('\n','\\\\\n').replace(' | ',' & ')
|
||||
row0,row2 = rows.split('\\\\\n',1)
|
||||
cols=row0.count(' & ')+1
|
||||
cal='{'+''.join('l' for j in range(cols))+'}'
|
||||
tabular = '\\begin{center}\n{\\begin{tabular}'+cal+'\\hline\n' + row0+'\\\\ \\hline\n'+row2 + ' \\\\ \\hline\n\\end{tabular}}\n\\end{center}'
|
||||
if row2.count('\n')>20: tabular='\\newpage\n'+tabular
|
||||
text = text[:item.start()] + tabular + text[item.end():]
|
||||
else:
|
||||
text = text[:item.start()] + '\\begin{quote}' + content + '\\end{quote}' + text[item.end():]
|
||||
@@ -136,32 +126,29 @@ def render(text,
|
||||
#############################################################
|
||||
|
||||
def sub(x):
|
||||
f = image_mapper(x.group('k'))
|
||||
if not f:
|
||||
return None
|
||||
return '\n\\begin{center}\\includegraphics[width=8cm]{%s}\\end{center}\n' % f
|
||||
|
||||
text = regex_image_width.sub(sub, text)
|
||||
text = regex_image.sub(sub, text)
|
||||
f=image_mapper(x.group('k'))
|
||||
if not f: return None
|
||||
return '\n\\begin{center}\\includegraphics[width=8cm]{%s}\\end{center}\n' % (f)
|
||||
text = regex_image_width.sub(sub,text)
|
||||
text = regex_image.sub(sub,text)
|
||||
|
||||
text = regex_link.sub('{\\\\footnotesize\\href{\g<k>}{\g<t>}}', text)
|
||||
text = regex_commas.sub('\g<t>', text)
|
||||
text = regex_noindent.sub('\n\\\\noindent \g<t>', text)
|
||||
text = regex_commas.sub('\g<t>',text)
|
||||
text = regex_noindent.sub('\n\\\\noindent \g<t>',text)
|
||||
|
||||
# ## fix paths in images
|
||||
regex = re.compile('\\\\_\w*\.(eps|png|jpg|gif)')
|
||||
### fix paths in images
|
||||
regex=re.compile('\\\\_\w*\.(eps|png|jpg|gif)')
|
||||
while True:
|
||||
match = regex.search(text)
|
||||
if not match:
|
||||
break
|
||||
text = text[:match.start()] + text[match.start() + 1:]
|
||||
# text = regex_quote_left.sub('``',text)
|
||||
# text = regex_quote_right.sub("''",text)
|
||||
match=regex.search(text)
|
||||
if not match: break
|
||||
text=text[:match.start()]+text[match.start()+1:]
|
||||
#text = regex_quote_left.sub('``',text)
|
||||
#text = regex_quote_right.sub("''",text)
|
||||
|
||||
if chapters:
|
||||
text = text.replace(r'\section*{', r'\chapter*{')
|
||||
text = text.replace(r'\section{', r'\chapter{')
|
||||
text = text.replace(r'subsection{', r'section{')
|
||||
text=text.replace(r'\section*{',r'\chapter*{')
|
||||
text=text.replace(r'\section{',r'\chapter{')
|
||||
text=text.replace(r'subsection{',r'section{')
|
||||
|
||||
#############################################################
|
||||
# process all code text
|
||||
@@ -169,64 +156,57 @@ def render(text,
|
||||
parts = text.split(META)
|
||||
text = parts[0]
|
||||
authors = []
|
||||
for i, (code, b) in enumerate(segments):
|
||||
if code is None:
|
||||
for i,(code,b) in enumerate(segments):
|
||||
if code==None:
|
||||
html = META
|
||||
else:
|
||||
if b == 'hidden':
|
||||
html = ''
|
||||
elif b == 'author':
|
||||
if b=='hidden':
|
||||
html=''
|
||||
elif b=='author':
|
||||
author = latex_escape(code.strip())
|
||||
authors.append(author)
|
||||
html = ''
|
||||
elif b == 'inxx':
|
||||
html = '\inxx{%s}' % latex_escape(code)
|
||||
elif b == 'cite':
|
||||
html = '~\cite{%s}' % latex_escape(code.strip())
|
||||
elif b == 'ref':
|
||||
html = '~\ref{%s}' % latex_escape(code.strip())
|
||||
elif b == 'latex':
|
||||
html=''
|
||||
elif b=='inxx':
|
||||
html='\inxx{%s}' % latex_escape(code)
|
||||
elif b=='cite':
|
||||
html='~\cite{%s}' % latex_escape(code.strip())
|
||||
elif b=='ref':
|
||||
html='~\ref{%s}' % latex_escape(code.strip())
|
||||
elif b=='latex':
|
||||
if '\n' in code:
|
||||
html = '\n\\begin{equation}\n%s\n\\end{equation}\n' % code.strip()
|
||||
html='\n\\begin{equation}\n%s\n\\end{equation}\n' % code.strip()
|
||||
else:
|
||||
html = '$%s$' % code.strip()
|
||||
elif b == 'latex_eqnarray':
|
||||
code = code.strip()
|
||||
code = '\\\\'.join(x.replace('=', '&=&', 1) for x in code.split('\\\\'))
|
||||
html = '\n\\begin{eqnarray}\n%s\n\\end{eqnarray}\n' % code
|
||||
html='$%s$' % code.strip()
|
||||
elif b=='latex_eqnarray':
|
||||
code=code.strip()
|
||||
code='\\\\'.join(x.replace('=','&=&',1) for x in code.split('\\\\'))
|
||||
html='\n\\begin{eqnarray}\n%s\n\\end{eqnarray}\n' % code
|
||||
elif b.startswith('latex_'):
|
||||
key = b[6:]
|
||||
html = '\\begin{%s}%s\\end{%s}' % (key, code, key)
|
||||
key=b[6:]
|
||||
html='\\begin{%s}%s\\end{%s}' % (key,code,key)
|
||||
elif b in extra:
|
||||
if code[:1] == '\n':
|
||||
code = code[1:]
|
||||
if code[-1:] == '\n':
|
||||
code = code[:-1]
|
||||
if code[:1]=='\n': code=code[1:]
|
||||
if code[-1:]=='\n': code=code[:-1]
|
||||
html = extra[b](code)
|
||||
elif code[:1] == '\n' or code[:-1] == '\n':
|
||||
if code[:1] == '\n':
|
||||
code = code[1:]
|
||||
if code[-1:] == '\n':
|
||||
code = code[:-1]
|
||||
elif code[:1]=='\n' or code[:-1]=='\n':
|
||||
if code[:1]=='\n': code=code[1:]
|
||||
if code[-1:]=='\n': code=code[:-1]
|
||||
if code.startswith('<') or code.startswith('{{') or code.startswith('http'):
|
||||
html = '\\begin{lstlisting}[keywords={}]\n%s\n\\end{lstlisting}' % code
|
||||
else:
|
||||
html = '\\begin{lstlisting}\n%s\n\\end{lstlisting}' % code
|
||||
else:
|
||||
if code[:1] == '\n':
|
||||
code = code[1:]
|
||||
if code[-1:] == '\n':
|
||||
code = code[:-1]
|
||||
if code[:1]=='\n': code=code[1:]
|
||||
if code[-1:]=='\n': code=code[:-1]
|
||||
html = '{\\ft %s}' % latex_escape(code)
|
||||
try:
|
||||
text = text + html + parts[i + 1]
|
||||
text = text+html+parts[i+1]
|
||||
except:
|
||||
text = text + '... WIKI PROCESSING ERROR ...'
|
||||
break
|
||||
text = text.replace(' ~\\cite', '~\\cite')
|
||||
text = text.replace(' ~\\cite','~\\cite')
|
||||
return text, title, authors
|
||||
|
||||
|
||||
WRAPPER = """
|
||||
\\documentclass[12pt]{article}
|
||||
\\usepackage{hyperref}
|
||||
@@ -259,14 +239,12 @@ WRAPPER = """
|
||||
\\end{document}
|
||||
"""
|
||||
|
||||
|
||||
def markmin2latex(data, image_mapper=lambda x: x, extra={},
|
||||
def markmin2latex(data, image_mapper=lambda x:x, extra={},
|
||||
wrapper=WRAPPER):
|
||||
body, title, authors = render(data, extra=extra, image_mapper=image_mapper)
|
||||
author = '\n\\and\n'.join(a.replace('\n', '\\\\\n\\footnotesize ') for a in authors)
|
||||
author = '\n\\and\n'.join(a.replace('\n','\\\\\n\\footnotesize ') for a in authors)
|
||||
return wrapper % dict(title=title, author=author, body=body)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--info", dest="info",
|
||||
@@ -274,39 +252,40 @@ if __name__ == '__main__':
|
||||
parser.add_option("-t", "--test", dest="test", action="store_true",
|
||||
default=False)
|
||||
parser.add_option("-n", "--no_wrapper", dest="no_wrapper",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-c", "--chapters", dest="chapters", action="store_true",
|
||||
default=False, help="switch section for chapter")
|
||||
action="store_true",default=False)
|
||||
parser.add_option("-c", "--chapters", dest="chapters",action="store_true",
|
||||
default=False,help="switch section for chapter")
|
||||
parser.add_option("-w", "--wrapper", dest="wrapper", default=False,
|
||||
help="latex file containing header and footer")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
if options.info:
|
||||
import markmin2html
|
||||
|
||||
markmin2latex(markmin2html.__doc__)
|
||||
elif options.test:
|
||||
doctest.testmod()
|
||||
else:
|
||||
if options.wrapper:
|
||||
fwrapper = open(options.wrapper, 'rb')
|
||||
fwrapper = open(options.wrapper,'rb')
|
||||
try:
|
||||
wrapper = fwrapper.read()
|
||||
finally:
|
||||
fwrapper.close()
|
||||
elif options.no_wrapper:
|
||||
wrapper = '%(body)s'
|
||||
wrapper = '%(body)s'
|
||||
else:
|
||||
wrapper = WRAPPER
|
||||
for f in args:
|
||||
fargs = open(f, 'r')
|
||||
fargs = open(f,'r')
|
||||
content_data = []
|
||||
try:
|
||||
content_data.append(fargs.read())
|
||||
finally:
|
||||
fargs.close()
|
||||
content = '\n'.join(content_data)
|
||||
output = markmin2latex(content,
|
||||
wrapper=wrapper,
|
||||
chapters=options.chapters)
|
||||
output= markmin2latex(content,
|
||||
wrapper=wrapper,
|
||||
chapters=options.chapters)
|
||||
print output
|
||||
|
||||
|
||||
|
||||
@@ -13,22 +13,21 @@ from markmin2latex import markmin2latex
|
||||
|
||||
__all__ = ['markmin2pdf']
|
||||
|
||||
|
||||
def removeall(path):
|
||||
ERROR_STR = """Error removing %(path)s, %(error)s """
|
||||
|
||||
ERROR_STR= """Error removing %(path)s, %(error)s """
|
||||
def rmgeneric(path, __func__):
|
||||
try:
|
||||
__func__(path)
|
||||
except OSError, (errno, strerror):
|
||||
print ERROR_STR % {'path': path, 'error': strerror}
|
||||
print ERROR_STR % {'path' : path, 'error': strerror }
|
||||
|
||||
files = [path]
|
||||
files=[path]
|
||||
|
||||
while files:
|
||||
file = files[0]
|
||||
file=files[0]
|
||||
if os.path.isfile(file):
|
||||
f = os.remove
|
||||
f=os.remove
|
||||
rmgeneric(file, os.remove)
|
||||
del files[0]
|
||||
elif os.path.isdir(file):
|
||||
@@ -37,7 +36,7 @@ def removeall(path):
|
||||
rmgeneric(file, os.rmdir)
|
||||
del files[0]
|
||||
else:
|
||||
files = [os.path.join(file, x) for x in nested] + files
|
||||
files = [os.path.join(file,x) for x in nested] + files
|
||||
|
||||
|
||||
def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
@@ -50,13 +49,13 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
- passes: defines how often pdflates should be run in the texfile.
|
||||
"""
|
||||
|
||||
pdflatex = pdflatex
|
||||
passes = passes
|
||||
warnings = []
|
||||
pdflatex=pdflatex
|
||||
passes=passes
|
||||
warnings=[]
|
||||
|
||||
# setup the envoriment
|
||||
tmpdir = mkdtemp()
|
||||
texfile = open(tmpdir + '/test.tex', 'wb')
|
||||
texfile = open(tmpdir+'/test.tex','wb')
|
||||
texfile.write(latex)
|
||||
texfile.seek(0)
|
||||
texfile.close()
|
||||
@@ -64,8 +63,8 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
|
||||
# start doing some work
|
||||
for i in range(0, passes):
|
||||
logfd, logname = mkstemp()
|
||||
outfile = os.fdopen(logfd)
|
||||
logfd,logname = mkstemp()
|
||||
outfile=os.fdopen(logfd)
|
||||
try:
|
||||
ret = subprocess.call([pdflatex,
|
||||
'-interaction=nonstopmode',
|
||||
@@ -76,18 +75,18 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
stderr=subprocess.PIPE)
|
||||
finally:
|
||||
outfile.close()
|
||||
re_errors = re.compile('^\!(.*)$', re.M)
|
||||
re_warnings = re.compile('^LaTeX Warning\:(.*)$', re.M)
|
||||
re_errors=re.compile('^\!(.*)$',re.M)
|
||||
re_warnings=re.compile('^LaTeX Warning\:(.*)$',re.M)
|
||||
flog = open(logname)
|
||||
try:
|
||||
loglines = flog.read()
|
||||
finally:
|
||||
flog.close()
|
||||
errors = re_errors.findall(loglines)
|
||||
warnings = re_warnings.findall(loglines)
|
||||
errors=re_errors.findall(loglines)
|
||||
warnings=re_warnings.findall(loglines)
|
||||
os.unlink(logname)
|
||||
|
||||
pdffile = texfile.rsplit('.', 1)[0] + '.pdf'
|
||||
pdffile=texfile.rsplit('.',1)[0]+'.pdf'
|
||||
if os.path.isfile(pdffile):
|
||||
fpdf = open(pdffile, 'rb')
|
||||
try:
|
||||
@@ -101,31 +100,31 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
|
||||
|
||||
|
||||
def markmin2pdf(text, image_mapper=lambda x: None, extra={}):
|
||||
return latex2pdf(markmin2latex(text, image_mapper=image_mapper, extra=extra))
|
||||
return latex2pdf(markmin2latex(text,image_mapper=image_mapper, extra=extra))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import doctest
|
||||
import markmin2html
|
||||
|
||||
if sys.argv[1:2] == ['-h']:
|
||||
if sys.argv[1:2]==['-h']:
|
||||
data, warnings, errors = markmin2pdf(markmin2html.__doc__)
|
||||
if errors:
|
||||
print 'ERRORS:' + '\n'.join(errors)
|
||||
print 'WARNGINS:' + '\n'.join(warnings)
|
||||
print 'ERRORS:'+'\n'.join(errors)
|
||||
print 'WARNGINS:'+'\n'.join(warnings)
|
||||
else:
|
||||
print data
|
||||
elif len(sys.argv) > 1:
|
||||
fargv = open(sys.argv[1], 'rb')
|
||||
elif len(sys.argv)>1:
|
||||
fargv = open(sys.argv[1],'rb')
|
||||
try:
|
||||
data, warnings, errors = markmin2pdf(fargv.read())
|
||||
finally:
|
||||
fargv.close()
|
||||
if errors:
|
||||
print 'ERRORS:' + '\n'.join(errors)
|
||||
print 'WARNGINS:' + '\n'.join(warnings)
|
||||
print 'ERRORS:'+'\n'.join(errors)
|
||||
print 'WARNGINS:'+'\n'.join(warnings)
|
||||
else:
|
||||
print data
|
||||
else:
|
||||
doctest.testmod()
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ logger = logging.getLogger("web2py.cache.redis")
|
||||
locker = thread.allocate_lock()
|
||||
|
||||
|
||||
def RedisCache(redis_conn=None, debug=False, with_lock=False, fail_gracefully=False, db=None):
|
||||
def RedisCache(*args, **vars):
|
||||
"""
|
||||
Usage example: put in models::
|
||||
|
||||
@@ -85,9 +85,7 @@ def RedisCache(redis_conn=None, debug=False, with_lock=False, fail_gracefully=Fa
|
||||
try:
|
||||
instance_name = 'redis_instance_' + current.request.application
|
||||
if not hasattr(RedisCache, instance_name):
|
||||
setattr(RedisCache, instance_name,
|
||||
RedisClient(redis_conn=redis_conn, debug=debug,
|
||||
with_lock=with_lock, fail_gracefully=fail_gracefully))
|
||||
setattr(RedisCache, instance_name, RedisClient(*args, **vars))
|
||||
return getattr(RedisCache, instance_name)
|
||||
finally:
|
||||
locker.release()
|
||||
|
||||
@@ -358,20 +358,20 @@ class RScheduler(Scheduler):
|
||||
(sd.can_visit == False) &
|
||||
(~sd.task_child.belongs(
|
||||
db(sd.can_visit == False)._select(sd.task_parent)
|
||||
)
|
||||
)
|
||||
)
|
||||
)._select(sd.task_child)
|
||||
)._select(sd.task_child)
|
||||
no_deps = db(
|
||||
(st.status.belongs((QUEUED, ASSIGNED))) &
|
||||
(
|
||||
(sd.id == None) | (st.id.belongs(deps_with_no_deps))
|
||||
|
||||
)
|
||||
)._select(st.id, distinct=True, left=sd.on(
|
||||
(st.id == sd.task_parent) &
|
||||
(sd.can_visit == False)
|
||||
)
|
||||
)
|
||||
)._select(st.id, distinct=True, left=sd.on(
|
||||
(st.id == sd.task_parent) &
|
||||
(sd.can_visit == False)
|
||||
)
|
||||
)
|
||||
|
||||
all_available = db(
|
||||
(st.status.belongs((QUEUED, ASSIGNED))) &
|
||||
@@ -449,9 +449,8 @@ class RScheduler(Scheduler):
|
||||
self.w_stats.status = POLLING
|
||||
# polling for 1 minute in total. If more groups are in,
|
||||
# polling is 1 minute in total
|
||||
logger.debug(' polling on %s', group)
|
||||
task_id = r_server.brpoplpush(queued_list, running_list,
|
||||
timeout=60 / len(self.group_names))
|
||||
logger.debug(' polling on %s' , group)
|
||||
task_id = r_server.brpoplpush(queued_list, running_list, timeout=60/len(self.group_names))
|
||||
logger.debug(' finished polling')
|
||||
self.w_stats.status = ACTIVE
|
||||
if task_id:
|
||||
@@ -465,8 +464,7 @@ class RScheduler(Scheduler):
|
||||
r_server.lrem(running_list, 0, task_id)
|
||||
r_server.hdel(running_dict, task_id)
|
||||
r_server.lrem(queued_list, 0, task_id)
|
||||
logger.error("we received a task that isn't there (%s)",
|
||||
task_id)
|
||||
logger.error("we received a task that isn't there (%s)" % task_id)
|
||||
return None
|
||||
break
|
||||
now = self.now()
|
||||
@@ -476,7 +474,7 @@ class RScheduler(Scheduler):
|
||||
db.commit()
|
||||
logger.debug(' work to do %s', task.id)
|
||||
else:
|
||||
logger.info('nothing to do')
|
||||
logger.info('nothing to do (%s)' % self.w_stats.status)
|
||||
return None
|
||||
times_run = task.times_run + 1
|
||||
if not task.prevent_drift:
|
||||
@@ -484,13 +482,9 @@ class RScheduler(Scheduler):
|
||||
seconds=task.period
|
||||
)
|
||||
else:
|
||||
# calc next_run_time based on available slots
|
||||
# see #1191
|
||||
next_run_time = task.start_time
|
||||
secondspassed = self.total_seconds(now - next_run_time)
|
||||
steps = secondspassed // task.period + 1
|
||||
next_run_time += datetime.timedelta(seconds=task.period * steps)
|
||||
|
||||
next_run_time = task.start_time + datetime.timedelta(
|
||||
seconds=task.period * times_run
|
||||
)
|
||||
if times_run < task.repeats or task.repeats == 0:
|
||||
# need to run (repeating task)
|
||||
run_again = True
|
||||
@@ -584,7 +578,7 @@ class RScheduler(Scheduler):
|
||||
and QUEUED or task.retry_failed == -1
|
||||
and QUEUED or st_mapping)
|
||||
db(st.id == task.task_id).update(
|
||||
times_failed=st.times_failed + 1,
|
||||
times_failed=db.scheduler_task.times_failed + 1,
|
||||
next_run_time=task.next_run_time,
|
||||
status=status,
|
||||
assigned_worker_name=self.worker_name
|
||||
|
||||
@@ -19,13 +19,13 @@ logger = logging.getLogger("web2py.session.redis")
|
||||
locker = thread.allocate_lock()
|
||||
|
||||
|
||||
def RedisSession(redis_conn, session_expiry=False, with_lock=False, db=None):
|
||||
def RedisSession(*args, **vars):
|
||||
"""
|
||||
Usage example: put in models::
|
||||
|
||||
from gluon.contrib.redis_utils import RConn
|
||||
rconn = RConn()
|
||||
from gluon.contrib.redis_session import RedisSession
|
||||
from gluon.contrib.redis_session
|
||||
sessiondb = RedisSession(redis_conn=rconn, with_lock=True, session_expiry=False)
|
||||
session.connect(request, response, db = sessiondb)
|
||||
|
||||
@@ -43,8 +43,7 @@ def RedisSession(redis_conn, session_expiry=False, with_lock=False, db=None):
|
||||
try:
|
||||
instance_name = 'redis_instance_' + current.request.application
|
||||
if not hasattr(RedisSession, instance_name):
|
||||
setattr(RedisSession, instance_name,
|
||||
RedisClient(redis_conn, session_expiry=session_expiry, with_lock=with_lock))
|
||||
setattr(RedisSession, instance_name, RedisClient(*args, **vars))
|
||||
return getattr(RedisSession, instance_name)
|
||||
finally:
|
||||
locker.release()
|
||||
|
||||
+7
-8
@@ -72,14 +72,13 @@ def _default_validators(db, field):
|
||||
if not field.notnull:
|
||||
requires = validators.IS_EMPTY_OR(requires)
|
||||
return requires
|
||||
# does not get here for reference and list:reference
|
||||
if field.unique:
|
||||
requires.insert(0, validators.IS_NOT_IN_DB(db, field))
|
||||
excluded_fields = ['string', 'upload', 'text', 'password', 'boolean']
|
||||
if (field.notnull or field.unique) and not field_type in excluded_fields:
|
||||
requires.insert(0, validators.IS_NOT_EMPTY())
|
||||
elif not field.notnull and not field.unique and requires:
|
||||
requires[0] = validators.IS_EMPTY_OR(requires[0], null='' if field in ('string', 'text', 'password') else None)
|
||||
requires.append(validators.IS_NOT_IN_DB(db, field))
|
||||
sff = ['in', 'do', 'da', 'ti', 'de', 'bo']
|
||||
if field.notnull and not field_type[:2] in sff:
|
||||
requires.append(validators.IS_NOT_EMPTY())
|
||||
elif not field.notnull and field_type[:2] in sff and requires:
|
||||
requires[0] = validators.IS_EMPTY_OR(requires[0])
|
||||
return requires
|
||||
|
||||
from gluon.serializers import custom_json, xml
|
||||
@@ -93,7 +92,7 @@ DAL.uuid = lambda x: web2py_uuid()
|
||||
DAL.representers = {
|
||||
'rows_render': sqlhtml.represent,
|
||||
'rows_xml': sqlhtml.SQLTABLE
|
||||
}
|
||||
}
|
||||
DAL.Field = Field
|
||||
DAL.Table = Table
|
||||
|
||||
|
||||
+9
-4
@@ -377,7 +377,12 @@ class Request(Storage):
|
||||
and callable(rest_action)):
|
||||
raise HTTP(405, "method not allowed")
|
||||
try:
|
||||
res = rest_action(*request.args, **request.vars)
|
||||
vars = request.vars
|
||||
if method == 'POST' and is_json:
|
||||
body = request.body.read()
|
||||
if len(body):
|
||||
vars = sj.loads(body)
|
||||
res = rest_action(*request.args, **vars)
|
||||
if is_json and not isinstance(res, str):
|
||||
res = json(res)
|
||||
return res
|
||||
@@ -812,7 +817,7 @@ class Session(Storage):
|
||||
response.session_data_name = 'session_data_%s' % masterapp.lower()
|
||||
response.session_cookie_expires = cookie_expires
|
||||
response.session_client = str(request.client).replace(':', '.')
|
||||
current._session_cookie_key = cookie_key
|
||||
response.session_cookie_key = cookie_key
|
||||
response.session_cookie_compression_level = compression_level
|
||||
|
||||
# check if there is a session_id in cookies
|
||||
@@ -1065,7 +1070,7 @@ class Session(Storage):
|
||||
|
||||
# if not cookie_key, but session_data_name in cookies
|
||||
# expire session_data_name from cookies
|
||||
if not current._session_cookie_key:
|
||||
if not response.session_cookie_key:
|
||||
if response.session_data_name in cookies:
|
||||
rcookies[response.session_data_name] = 'expired'
|
||||
rcookies[response.session_data_name]['path'] = '/'
|
||||
@@ -1128,7 +1133,7 @@ class Session(Storage):
|
||||
name = response.session_data_name
|
||||
compression_level = response.session_cookie_compression_level
|
||||
value = secure_dumps(dict(self),
|
||||
current._session_cookie_key,
|
||||
response.session_cookie_key,
|
||||
compression_level=compression_level)
|
||||
rcookies = response.cookies
|
||||
rcookies.pop(name, None)
|
||||
|
||||
+102
-112
@@ -116,7 +116,6 @@ __all__ = [
|
||||
|
||||
DEFAULT_PASSWORD_DISPLAY = '*' * 8
|
||||
|
||||
|
||||
def xmlescape(data, quote=True):
|
||||
"""
|
||||
Returns an escaped string of the provided data
|
||||
@@ -140,14 +139,12 @@ def xmlescape(data, quote=True):
|
||||
data = cgi.escape(data, quote).replace("'", "'")
|
||||
return data
|
||||
|
||||
|
||||
def call_as_list(f, *a, **b):
|
||||
if not isinstance(f, (list, tuple)):
|
||||
f = [f]
|
||||
for item in f:
|
||||
item(*a, **b)
|
||||
|
||||
|
||||
def truncate_string(text, length, dots='...'):
|
||||
text = text.decode('utf-8')
|
||||
if len(text) > length:
|
||||
@@ -155,26 +152,27 @@ def truncate_string(text, length, dots='...'):
|
||||
return text
|
||||
|
||||
|
||||
def URL(a=None,
|
||||
c=None,
|
||||
f=None,
|
||||
r=None,
|
||||
args=None,
|
||||
vars=None,
|
||||
anchor='',
|
||||
extension=None,
|
||||
env=None,
|
||||
hmac_key=None,
|
||||
hash_vars=True,
|
||||
salt=None,
|
||||
user_signature=None,
|
||||
scheme=None,
|
||||
host=None,
|
||||
port=None,
|
||||
encode_embedded_slash=False,
|
||||
url_encode=True,
|
||||
language=None
|
||||
):
|
||||
def URL(
|
||||
a=None,
|
||||
c=None,
|
||||
f=None,
|
||||
r=None,
|
||||
args=None,
|
||||
vars=None,
|
||||
anchor='',
|
||||
extension=None,
|
||||
env=None,
|
||||
hmac_key=None,
|
||||
hash_vars=True,
|
||||
salt=None,
|
||||
user_signature=None,
|
||||
scheme=None,
|
||||
host=None,
|
||||
port=None,
|
||||
encode_embedded_slash=False,
|
||||
url_encode=True,
|
||||
language=None,
|
||||
):
|
||||
"""
|
||||
generates a url '/a/c/f' corresponding to application a, controller c
|
||||
and function f. If r=request is passed, a, c, f are set, respectively,
|
||||
@@ -258,6 +256,10 @@ def URL(a=None,
|
||||
|
||||
>>> str(URL(a='a', c='c', f='f', anchor='%(id)d', url_encode=True))
|
||||
'/a/c/f#%25%28id%29d'
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
from rewrite import url_out # done here in case used not-in web2py
|
||||
@@ -308,7 +310,7 @@ def URL(a=None,
|
||||
else:
|
||||
function = f
|
||||
|
||||
# if the url gets a static resource, don't force extension
|
||||
# if the url gets a static resource, don't force extention
|
||||
if controller == 'static':
|
||||
extension = None
|
||||
# add static version to url
|
||||
@@ -437,7 +439,7 @@ def verifyURL(request, hmac_key=None, hash_vars=True, salt=None, user_signature=
|
||||
|
||||
"""
|
||||
|
||||
if '_signature' not in request.get_vars:
|
||||
if not '_signature' in request.get_vars:
|
||||
return False # no signature in the request URL
|
||||
|
||||
# check if user_signature requires
|
||||
@@ -537,24 +539,19 @@ class XmlComponent(object):
|
||||
return CAT(*components)
|
||||
|
||||
def add_class(self, name):
|
||||
"""
|
||||
add a class to _class attribute
|
||||
"""
|
||||
""" add a class to _class attribute """
|
||||
c = self['_class']
|
||||
classes = (set(c.split()) if c else set()) | set(name.split())
|
||||
self['_class'] = ' '.join(classes) if classes else None
|
||||
return self
|
||||
|
||||
def remove_class(self, name):
|
||||
"""
|
||||
remove a class from _class attribute
|
||||
"""
|
||||
""" remove a class from _class attribute """
|
||||
c = self['_class']
|
||||
classes = (set(c.split()) if c else set()) - set(name.split())
|
||||
self['_class'] = ' '.join(classes) if classes else None
|
||||
return self
|
||||
|
||||
|
||||
class XML(XmlComponent):
|
||||
"""
|
||||
use it to wrap a string that contains XML/HTML so that it will not be
|
||||
@@ -663,11 +660,11 @@ class XML(XmlComponent):
|
||||
"""
|
||||
to be considered experimental since the behavior of this method
|
||||
is questionable
|
||||
another option could be `TAG(self.text).elements(*args, **kwargs)`
|
||||
another option could be `TAG(self.text).elements(*args,**kwargs)`
|
||||
"""
|
||||
return []
|
||||
|
||||
# ## important to allow safe session.flash=T(....)
|
||||
### important to allow safe session.flash=T(....)
|
||||
|
||||
|
||||
def XML_unpickle(data):
|
||||
@@ -760,7 +757,7 @@ class DIV(XmlComponent):
|
||||
Examples:
|
||||
|
||||
>>> a=DIV()
|
||||
>>> a.insert(0, SPAN('x'))
|
||||
>>> a.insert(0,SPAN('x'))
|
||||
>>> print a
|
||||
<div><span>x</span></div>
|
||||
"""
|
||||
@@ -856,7 +853,7 @@ class DIV(XmlComponent):
|
||||
"""
|
||||
components = []
|
||||
for c in self.components:
|
||||
if isinstance(c, (allowed_parents, CAT)):
|
||||
if isinstance(c, (allowed_parents,CAT)):
|
||||
pass
|
||||
elif wrap_lambda:
|
||||
c = wrap_lambda(c)
|
||||
@@ -955,6 +952,7 @@ class DIV(XmlComponent):
|
||||
# get the xml for the inner components
|
||||
co = join([xmlescape(component) for component in
|
||||
self.components])
|
||||
|
||||
return (fa, co)
|
||||
|
||||
def xml(self):
|
||||
@@ -989,7 +987,7 @@ class DIV(XmlComponent):
|
||||
|
||||
Examples:
|
||||
|
||||
>>> markdown = lambda text, tag=None, attributes={}: \
|
||||
>>> markdown = lambda text,tag=None,attributes={}: \
|
||||
{None: re.sub('\s+',' ',text), \
|
||||
'h1':'#'+text+'\\n\\n', \
|
||||
'p':text+'\\n'}.get(tag,text)
|
||||
@@ -1026,7 +1024,7 @@ class DIV(XmlComponent):
|
||||
Examples:
|
||||
|
||||
>>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y'))))
|
||||
>>> for c in a.elements('span', first_only=True): c[0]='z'
|
||||
>>> for c in a.elements('span',first_only=True): c[0]='z'
|
||||
>>> print a
|
||||
<div><div><span>z</span>3<div><span>y</span></div></div></div>
|
||||
>>> for c in a.elements('span'): c[0]='z'
|
||||
@@ -1058,7 +1056,7 @@ class DIV(XmlComponent):
|
||||
|
||||
>>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc'))))
|
||||
>>> b = a.elements('span.abc', replace=P('x', _class='xyz'))
|
||||
>>> print a # We should .xml() here instead of print
|
||||
>>> print a
|
||||
<div><div><p class="xyz">x</p><div><p class="xyz">x</p><p class="xyz">x</p></div></div></div>
|
||||
|
||||
"replace" can be a callable, which will be passed the original element and
|
||||
@@ -1170,13 +1168,13 @@ class DIV(XmlComponent):
|
||||
return i
|
||||
else:
|
||||
self[i] = replace(self[i]) if callable(replace) else replace
|
||||
return i + 1
|
||||
return i+1
|
||||
# loop the components
|
||||
if find_text or find_components:
|
||||
i = 0
|
||||
while i < len(self.components):
|
||||
while i<len(self.components):
|
||||
c = self[i]
|
||||
j = i + 1
|
||||
j = i+1
|
||||
if check and find_text and isinstance(c, str) and \
|
||||
((is_regex and find_text.search(c)) or (str(find_text) in c)):
|
||||
j = replace_component(i)
|
||||
@@ -1267,7 +1265,6 @@ class __tag_div__(DIV):
|
||||
|
||||
copy_reg.pickle(__tag_div__, TAG_pickler, TAG_unpickler)
|
||||
|
||||
|
||||
class __TAG__(XmlComponent):
|
||||
|
||||
"""
|
||||
@@ -1592,7 +1589,6 @@ class A(DIV):
|
||||
self['_data-w2p_pre_call'] = self['pre_call']
|
||||
return DIV.xml(self)
|
||||
|
||||
|
||||
class BUTTON(DIV):
|
||||
|
||||
tag = 'button'
|
||||
@@ -1867,11 +1863,11 @@ class INPUT(DIV):
|
||||
print traceback.format_exc()
|
||||
msg = "Validation error, field:%s %s" % (name,validator)
|
||||
raise Exception(msg)
|
||||
if errors is not None:
|
||||
if not errors is None:
|
||||
self.vars[name] = value
|
||||
self.errors[name] = errors
|
||||
break
|
||||
if name not in self.errors:
|
||||
if not name in self.errors:
|
||||
self.vars[name] = value
|
||||
return True
|
||||
return False
|
||||
@@ -1886,7 +1882,7 @@ class INPUT(DIV):
|
||||
_value = None
|
||||
else:
|
||||
_value = str(self['_value'])
|
||||
if '_checked' in self.attributes and 'value' not in self.attributes:
|
||||
if '_checked' in self.attributes and not 'value' in self.attributes:
|
||||
pass
|
||||
elif t == 'checkbox':
|
||||
if not _value:
|
||||
@@ -1916,7 +1912,8 @@ class INPUT(DIV):
|
||||
if name and hasattr(self, 'errors') \
|
||||
and self.errors.get(name, None) \
|
||||
and self['hideerror'] != True:
|
||||
self['_class'] = (self['_class'] and self['_class'] + ' ' or '') + 'invalidinput'
|
||||
self['_class'] = (self['_class'] and self['_class']
|
||||
+ ' ' or '') + 'invalidinput'
|
||||
return DIV.xml(self) + DIV(
|
||||
DIV(
|
||||
self.errors[name], _class='error',
|
||||
@@ -1944,11 +1941,11 @@ class TEXTAREA(INPUT):
|
||||
tag = 'textarea'
|
||||
|
||||
def _postprocessing(self):
|
||||
if '_rows' not in self.attributes:
|
||||
if not '_rows' in self.attributes:
|
||||
self['_rows'] = 10
|
||||
if '_cols' not in self.attributes:
|
||||
if not '_cols' in self.attributes:
|
||||
self['_cols'] = 40
|
||||
if self['value'] is not None:
|
||||
if not self['value'] is None:
|
||||
self.components = [self['value']]
|
||||
elif self.components:
|
||||
self['value'] = self.components[0]
|
||||
@@ -1959,7 +1956,7 @@ class OPTION(DIV):
|
||||
tag = 'option'
|
||||
|
||||
def _fixup(self):
|
||||
if '_value' not in self.attributes:
|
||||
if not '_value' in self.attributes:
|
||||
self.attributes['_value'] = str(self.components[0])
|
||||
|
||||
|
||||
@@ -2015,10 +2012,11 @@ class SELECT(INPUT):
|
||||
options = itertools.chain(*component_list)
|
||||
|
||||
value = self['value']
|
||||
if value is not None:
|
||||
if not value is None:
|
||||
if not self['_multiple']:
|
||||
for c in options: # my patch
|
||||
if ((value is not None) and (str(c['_value']) == str(value))):
|
||||
if ((value is not None) and
|
||||
(str(c['_value']) == str(value))):
|
||||
c['_selected'] = 'selected'
|
||||
else:
|
||||
c['_selected'] = None
|
||||
@@ -2028,7 +2026,8 @@ class SELECT(INPUT):
|
||||
else:
|
||||
values = [str(value)]
|
||||
for c in options: # my patch
|
||||
if ((value is not None) and (str(c['_value']) in values)):
|
||||
if ((value is not None) and
|
||||
(str(c['_value']) in values)):
|
||||
c['_selected'] = 'selected'
|
||||
else:
|
||||
c['_selected'] = None
|
||||
@@ -2078,15 +2077,16 @@ class FORM(DIV):
|
||||
def assert_status(self, status, request_vars):
|
||||
return status
|
||||
|
||||
def accepts(self,
|
||||
request_vars,
|
||||
session=None,
|
||||
formname='default',
|
||||
keepvalues=False,
|
||||
onvalidation=None,
|
||||
hideerror=False,
|
||||
**kwargs
|
||||
):
|
||||
def accepts(
|
||||
self,
|
||||
request_vars,
|
||||
session=None,
|
||||
formname='default',
|
||||
keepvalues=False,
|
||||
onvalidation=None,
|
||||
hideerror=False,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
kwargs is not used but allows to specify the same interface for FORM and SQLFORM
|
||||
"""
|
||||
@@ -2128,7 +2128,8 @@ class FORM(DIV):
|
||||
onsuccess = onvalidation.get('onsuccess', None)
|
||||
onfailure = onvalidation.get('onfailure', None)
|
||||
onchange = onvalidation.get('onchange', None)
|
||||
if [k for k in onvalidation if k not in ('onsuccess', 'onfailure', 'onchange')]:
|
||||
if [k for k in onvalidation if not k in (
|
||||
'onsuccess', 'onfailure', 'onchange')]:
|
||||
raise RuntimeError('Invalid key in onvalidate dict')
|
||||
if onsuccess and status:
|
||||
call_as_list(onsuccess, self)
|
||||
@@ -2143,7 +2144,7 @@ class FORM(DIV):
|
||||
call_as_list(onvalidation, self)
|
||||
if self.errors:
|
||||
status = False
|
||||
if session is not None:
|
||||
if not session is None:
|
||||
if hasattr(self, 'record_hash'):
|
||||
formkey = self.record_hash + ':' + web2py_uuid()
|
||||
else:
|
||||
@@ -2157,22 +2158,25 @@ class FORM(DIV):
|
||||
return status
|
||||
|
||||
def _postprocessing(self):
|
||||
if '_action' not in self.attributes:
|
||||
if not '_action' in self.attributes:
|
||||
self['_action'] = '#'
|
||||
if '_method' not in self.attributes:
|
||||
if not '_method' in self.attributes:
|
||||
self['_method'] = 'post'
|
||||
if '_enctype' not in self.attributes:
|
||||
if not '_enctype' in self.attributes:
|
||||
self['_enctype'] = 'multipart/form-data'
|
||||
|
||||
def hidden_fields(self):
|
||||
c = []
|
||||
attr = self.attributes.get('hidden', {})
|
||||
if 'hidden' in self.attributes:
|
||||
c = [INPUT(_type='hidden', _name=key, _value=value) for (key, value) in attr.iteritems()]
|
||||
c = [INPUT(_type='hidden', _name=key, _value=value)
|
||||
for (key, value) in attr.iteritems()]
|
||||
if hasattr(self, 'formkey') and self.formkey:
|
||||
c.append(INPUT(_type='hidden', _name='_formkey', _value=self.formkey))
|
||||
c.append(INPUT(_type='hidden', _name='_formkey',
|
||||
_value=self.formkey))
|
||||
if hasattr(self, 'formname') and self.formname:
|
||||
c.append(INPUT(_type='hidden', _name='_formname', _value=self.formname))
|
||||
c.append(INPUT(_type='hidden', _name='_formname',
|
||||
_value=self.formname))
|
||||
return DIV(c, _style="display:none;")
|
||||
|
||||
def xml(self):
|
||||
@@ -2217,7 +2221,8 @@ class FORM(DIV):
|
||||
kwargs['request_vars'] = kwargs.get(
|
||||
'request_vars', current.request.post_vars)
|
||||
kwargs['session'] = kwargs.get('session', current.session)
|
||||
kwargs['dbio'] = kwargs.get('dbio', False) # necessary for SQLHTML forms
|
||||
kwargs['dbio'] = kwargs.get('dbio', False)
|
||||
# necessary for SQLHTML forms
|
||||
|
||||
onsuccess = kwargs.get('onsuccess', 'flash')
|
||||
onfailure = kwargs.get('onfailure', 'flash')
|
||||
@@ -2296,7 +2301,8 @@ class FORM(DIV):
|
||||
|
||||
|
||||
"""
|
||||
kwargs['dbio'] = kwargs.get('dbio', True) # necessary for SQLHTML forms
|
||||
kwargs['dbio'] = kwargs.get('dbio', True)
|
||||
# necessary for SQLHTML forms
|
||||
self.validate(**kwargs)
|
||||
return self
|
||||
|
||||
@@ -2342,9 +2348,10 @@ class FORM(DIV):
|
||||
def sanitizer(obj):
|
||||
if isinstance(obj, dict):
|
||||
for k in obj.keys():
|
||||
if any([unsafe in str(k).upper() for unsafe in UNSAFE]):
|
||||
# erease unsafe pair
|
||||
obj.pop(k)
|
||||
if any([unsafe in str(k).upper() for
|
||||
unsafe in UNSAFE]):
|
||||
# erease unsafe pair
|
||||
obj.pop(k)
|
||||
else:
|
||||
# not implemented
|
||||
pass
|
||||
@@ -2370,10 +2377,8 @@ class FORM(DIV):
|
||||
return [flatten(item) for item in newobj]
|
||||
else:
|
||||
return newobj
|
||||
else:
|
||||
return str(newobj)
|
||||
else:
|
||||
return newobj
|
||||
else: return str(newobj)
|
||||
else: return newobj
|
||||
return flatten(d)
|
||||
|
||||
def as_json(self, sanitize=True):
|
||||
@@ -2500,19 +2505,19 @@ class MENU(DIV):
|
||||
self.data = data
|
||||
self.attributes = args
|
||||
self.components = []
|
||||
if '_class' not in self.attributes:
|
||||
if not '_class' in self.attributes:
|
||||
self['_class'] = 'web2py-menu web2py-menu-vertical'
|
||||
if 'ul_class' not in self.attributes:
|
||||
if not 'ul_class' in self.attributes:
|
||||
self['ul_class'] = 'web2py-menu-vertical'
|
||||
if 'li_class' not in self.attributes:
|
||||
if not 'li_class' in self.attributes:
|
||||
self['li_class'] = 'web2py-menu-expand'
|
||||
if 'li_first' not in self.attributes:
|
||||
if not 'li_first' in self.attributes:
|
||||
self['li_first'] = 'web2py-menu-first'
|
||||
if 'li_last' not in self.attributes:
|
||||
if not 'li_last' in self.attributes:
|
||||
self['li_last'] = 'web2py-menu-last'
|
||||
if 'li_active' not in self.attributes:
|
||||
if not 'li_active' in self.attributes:
|
||||
self['li_active'] = 'web2py-menu-active'
|
||||
if 'mobile' not in self.attributes:
|
||||
if not 'mobile' in self.attributes:
|
||||
self['mobile'] = False
|
||||
|
||||
def serialize(self, data, level=0):
|
||||
@@ -2572,7 +2577,7 @@ class MENU(DIV):
|
||||
item[3], select, prefix=CAT(prefix, item[0], '/'))
|
||||
select['_onchange'] = 'window.location=this.value'
|
||||
# avoid to wrap the select if no custom items are present
|
||||
html = DIV(select, self.serialize(custom_items)) if len(custom_items) else select
|
||||
html = DIV(select, self.serialize(custom_items)) if len(custom_items) else select
|
||||
return html
|
||||
|
||||
def xml(self):
|
||||
@@ -2582,11 +2587,12 @@ class MENU(DIV):
|
||||
return self.serialize(self.data, 0).xml()
|
||||
|
||||
|
||||
def embed64(filename=None,
|
||||
file=None,
|
||||
data=None,
|
||||
extension='image/gif'
|
||||
):
|
||||
def embed64(
|
||||
filename=None,
|
||||
file=None,
|
||||
data=None,
|
||||
extension='image/gif',
|
||||
):
|
||||
"""
|
||||
helper to encode the provided (binary) data into base64.
|
||||
|
||||
@@ -2604,7 +2610,6 @@ def embed64(filename=None,
|
||||
return 'data:%s;base64,%s' % (extension, data)
|
||||
|
||||
|
||||
# TODO: Check if this test() is still relevant now that we have gluon/tests/test_html.py
|
||||
def test():
|
||||
"""
|
||||
Example:
|
||||
@@ -2804,7 +2809,7 @@ class MARKMIN(XmlComponent):
|
||||
self.extra = extra or {}
|
||||
self.allowed = allowed or {}
|
||||
self.sep = sep
|
||||
self.url = URL if url is True else url
|
||||
self.url = URL if url == True else url
|
||||
self.environment = environment
|
||||
self.latex = latex
|
||||
self.autolinks = autolinks
|
||||
@@ -2828,26 +2833,11 @@ class MARKMIN(XmlComponent):
|
||||
def __str__(self):
|
||||
return self.xml()
|
||||
|
||||
|
||||
def ASSIGNJS(**kargs):
|
||||
"""
|
||||
Example:
|
||||
ASSIGNJS(var1='1', var2='2') will return the following javascript variables assignations :
|
||||
|
||||
var var1 = "1";
|
||||
var var2 = "2";
|
||||
|
||||
Args:
|
||||
**kargs: Any keywords arguments and assigned values.
|
||||
|
||||
Returns:
|
||||
Javascript vars assignations for the key/value passed.
|
||||
|
||||
"""
|
||||
from gluon.serializers import json
|
||||
s = ""
|
||||
for key, value in kargs.items():
|
||||
s += 'var %s = %s;\n' % (key, json(value))
|
||||
s+='var %s = %s;\n' % (key, json(value))
|
||||
return XML(s)
|
||||
|
||||
|
||||
|
||||
@@ -61,13 +61,7 @@ PY_STRING_LITERAL_RE = r'(?<=[^\w]T\()(?P<name>'\
|
||||
+ r"(?:'(?:[^'\\]|\\.)*')|" + r'(?:"""(?:[^"]|"{1,2}(?!"))*""")|'\
|
||||
+ r'(?:"(?:[^"\\]|\\.)*"))'
|
||||
|
||||
PY_M_STRING_LITERAL_RE = r'(?<=[^\w]T\.M\()(?P<name>'\
|
||||
+ r"[uU]?[rR]?(?:'''(?:[^']|'{1,2}(?!'))*''')|"\
|
||||
+ r"(?:'(?:[^'\\]|\\.)*')|" + r'(?:"""(?:[^"]|"{1,2}(?!"))*""")|'\
|
||||
+ r'(?:"(?:[^"\\]|\\.)*"))'
|
||||
|
||||
regex_translate = re.compile(PY_STRING_LITERAL_RE, re.DOTALL)
|
||||
regex_translate_m = re.compile(PY_M_STRING_LITERAL_RE, re.DOTALL)
|
||||
regex_param = re.compile(r'{(?P<s>.+?)}')
|
||||
|
||||
# pattern for a valid accept_language
|
||||
@@ -966,7 +960,6 @@ def findT(path, language=DEFAULT_LANGUAGE):
|
||||
+ listdir(vp, '^.+\.html$', 0) + listdir(mop, '^.+\.py$', 0):
|
||||
data = read_locked(filename)
|
||||
items = regex_translate.findall(data)
|
||||
items += regex_translate_m.findall(data)
|
||||
for item in items:
|
||||
try:
|
||||
message = safe_eval(item)
|
||||
@@ -1002,23 +995,6 @@ def update_all_languages(application_path):
|
||||
findT(application_path, language[:-3])
|
||||
|
||||
|
||||
def update_from_langfile(target, source):
|
||||
"""this will update untranslated messages in target from source (where both are language files)
|
||||
this can be used as first step when creating language file for new but very similar language
|
||||
or if you want update your app from welcome app of newer web2py version
|
||||
or in non-standard scenarios when you work on target and from any reason you have partial translation in source
|
||||
"""
|
||||
src = read_dict(source)
|
||||
sentences = read_dict(target)
|
||||
for key in sentences:
|
||||
val = sentences[key]
|
||||
if not val or val == key:
|
||||
new_val = src.get(key)
|
||||
if new_val and new_val != val:
|
||||
sentences[key] = new_val
|
||||
write_dict(target, sentences)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import doctest
|
||||
doctest.testmod()
|
||||
|
||||
+4
-3
@@ -80,9 +80,10 @@ locale.setlocale(locale.LC_CTYPE, "C") # IMPORTANT, web2py requires locale "C"
|
||||
exists = os.path.exists
|
||||
pjoin = os.path.join
|
||||
|
||||
try:
|
||||
logpath = abspath("logging.conf")
|
||||
if exists(logpath):
|
||||
logging.config.fileConfig(abspath("logging.conf"))
|
||||
except: # fails on GAE or when logfile is missing
|
||||
else:
|
||||
logging.basicConfig()
|
||||
logger = logging.getLogger("web2py")
|
||||
|
||||
@@ -360,7 +361,7 @@ def wsgibase(environ, responder):
|
||||
local_hosts = global_settings.local_hosts
|
||||
client = get_client(env)
|
||||
x_req_with = str(env.http_x_requested_with).lower()
|
||||
cmd_opts = global_settings.cmd_options
|
||||
cmd_opts = request.global_settings.cmd_options
|
||||
|
||||
request.update(
|
||||
client = client,
|
||||
|
||||
+1
-1
Submodule gluon/packages/dal updated: 60e97e7cfd...4b37722a22
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -642,7 +642,7 @@ def regex_url_in(request, environ):
|
||||
items = filename.split('/', 1)
|
||||
if regex_version.match(items[0]):
|
||||
version, filename = items
|
||||
static_folder = pjoin(global_settings.applications_parent,
|
||||
static_folder = pjoin(request.env.applications_parent,
|
||||
'applications', application, 'static')
|
||||
static_file = os.path.abspath(pjoin(static_folder, filename))
|
||||
if not static_file.startswith(static_folder):
|
||||
@@ -947,7 +947,7 @@ class MapUrlIn(object):
|
||||
|
||||
if len(self.args) == 1 and self.arg0 in self.router.root_static:
|
||||
self.controller = self.request.controller = 'static'
|
||||
root_static_file = pjoin(global_settings.applications_parent,
|
||||
root_static_file = pjoin(self.request.env.applications_parent,
|
||||
'applications', self.application,
|
||||
self.controller, self.arg0)
|
||||
log_rewrite("route: root static=%s" % root_static_file)
|
||||
@@ -1016,11 +1016,11 @@ class MapUrlIn(object):
|
||||
# if language-specific file doesn't exist, try same file in static
|
||||
#
|
||||
if self.language:
|
||||
static_file = pjoin(global_settings.applications_parent,
|
||||
static_file = pjoin(self.request.env.applications_parent,
|
||||
'applications', self.application,
|
||||
'static', self.language, file)
|
||||
if not self.language or not isfile(static_file):
|
||||
static_file = pjoin(global_settings.applications_parent,
|
||||
static_file = pjoin(self.request.env.applications_parent,
|
||||
'applications', self.application,
|
||||
'static', file)
|
||||
self.extension = None
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ class JobGraph(object):
|
||||
task_child=task_child,
|
||||
job_name=self.job_name)
|
||||
|
||||
def validate(self, job_name=None):
|
||||
def validate(self, job_name):
|
||||
"""Validates if all tasks job_name can be completed, i.e. there
|
||||
are no mutual dependencies among tasks.
|
||||
Commits at the end if successfull, or it rollbacks the entire
|
||||
|
||||
+20
-38
@@ -677,7 +677,7 @@ class AutocompleteWidget(object):
|
||||
def callback(self):
|
||||
if self.keyword in self.request.vars:
|
||||
field = self.fields[0]
|
||||
if type(field) is Field.Virtual:
|
||||
if type(field) is FieldVirtual:
|
||||
records = []
|
||||
table_rows = self.db(self.db[field.tablename]).select(orderby=self.orderby)
|
||||
count = 0
|
||||
@@ -741,7 +741,7 @@ class AutocompleteWidget(object):
|
||||
del attr['requires']
|
||||
attr['_name'] = key2
|
||||
value = attr['value']
|
||||
if type(self.fields[0]) is Field.Virtual:
|
||||
if type(self.fields[0]) is FieldVirtual:
|
||||
record = None
|
||||
table_rows = self.db(self.db[self.fields[0].tablename]).select(orderby=self.orderby)
|
||||
for row in table_rows:
|
||||
@@ -901,7 +901,6 @@ def formstyle_bootstrap3_stacked(form, fields):
|
||||
elif controls['_type'] == 'checkbox':
|
||||
label['_for'] = None
|
||||
label.insert(0, controls)
|
||||
label.insert(0, ' ')
|
||||
_controls = DIV(label, _help, _class="checkbox")
|
||||
label = ''
|
||||
elif isinstance(controls, (SELECT, TEXTAREA)):
|
||||
@@ -951,7 +950,6 @@ def formstyle_bootstrap3_inline_factory(col_label_size=3):
|
||||
elif controls['_type'] == 'checkbox':
|
||||
label['_for'] = None
|
||||
label.insert(0, controls)
|
||||
label.insert(1, ' ')
|
||||
_controls = DIV(DIV(label, _help, _class="checkbox"),
|
||||
_class="%s %s" % (offset_class, col_class))
|
||||
label = ''
|
||||
@@ -1897,39 +1895,33 @@ class SQLFORM(FORM):
|
||||
else:
|
||||
field_type = field.type
|
||||
|
||||
operators = SELECT(*[OPTION(T(option), _value=option) for option in options],
|
||||
_class='form-control')
|
||||
operators = SELECT(*[OPTION(T(option), _value=option) for option in options], _class='form-control')
|
||||
_id = "%s_%s" % (value_id, name)
|
||||
if field_type in ['boolean', 'double', 'time', 'integer']:
|
||||
widget_ = SQLFORM.widgets[field_type]
|
||||
value_input = widget_.widget(field, field.default, _id=_id,
|
||||
_class=widget_._class + ' form-control')
|
||||
value_input = widget_.widget(field, field.default, _id=_id, _class=widget_._class + ' form-control')
|
||||
elif field_type == 'date':
|
||||
iso_format = {'_data-w2p_date_format': '%Y-%m-%d'}
|
||||
widget_ = SQLFORM.widgets.date
|
||||
value_input = widget_.widget(field, field.default, _id=_id,
|
||||
_class=widget_._class + ' form-control',
|
||||
**iso_format)
|
||||
value_input = widget_.widget(field, field.default, _id=_id, _class=widget_._class + ' form-control', **iso_format)
|
||||
elif field_type == 'datetime':
|
||||
iso_format = {'_data-w2p_datetime_format': '%Y-%m-%d %H:%M:%S'}
|
||||
widget_ = SQLFORM.widgets.datetime
|
||||
value_input = widget_.widget(field, field.default, _id=_id,
|
||||
_class=widget_._class + ' form-control',
|
||||
**iso_format)
|
||||
elif hasattr(field.requires, 'options'):
|
||||
value_input = widget_.widget(field, field.default, _id=_id, _class=widget_._class + ' form-control', **iso_format)
|
||||
elif (field_type.startswith('reference ') or
|
||||
field_type.startswith('list:reference ')) and \
|
||||
hasattr(field.requires, 'options') or \
|
||||
hasattr(field.requires, 'options'):
|
||||
value_input = SELECT(
|
||||
*[OPTION(v, _value=k)
|
||||
for k, v in field.requires.options()],
|
||||
_class='form-control',
|
||||
**dict(_id=_id))
|
||||
elif (field_type.startswith('integer') or
|
||||
field_type.startswith('reference ') or
|
||||
field_type.startswith('list:integer') or
|
||||
field_type.startswith('list:reference ')):
|
||||
elif field_type.startswith('reference ') or \
|
||||
field_type.startswith('list:integer') or \
|
||||
field_type.startswith('list:reference '):
|
||||
widget_ = SQLFORM.widgets.integer
|
||||
value_input = widget_.widget(
|
||||
field, field.default, _id=_id,
|
||||
_class=widget_._class + ' form-control')
|
||||
value_input = widget_.widget(field, field.default, _id=_id, _class=widget_._class + ' form-control')
|
||||
else:
|
||||
value_input = INPUT(
|
||||
_type='text', _id=_id,
|
||||
@@ -2191,7 +2183,7 @@ class SQLFORM(FORM):
|
||||
buttonurl=url(args=[]), callback=None,
|
||||
delete=None, trap=True, noconfirm=None, title=None):
|
||||
if showbuttontext:
|
||||
return A(SPAN(_class=ui.get(buttonclass)), CAT(' '),
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
SPAN(T(buttontext), _title=title or T(buttontext),
|
||||
_class=ui.get('buttontext')),
|
||||
_href=buttonurl,
|
||||
@@ -2212,12 +2204,15 @@ class SQLFORM(FORM):
|
||||
|
||||
dbset = db(query, ignore_common_filters=ignore_common_filters)
|
||||
tablenames = db._adapter.tables(dbset.query)
|
||||
print dbset.query
|
||||
print tablenames
|
||||
if left is not None:
|
||||
if not isinstance(left, (list, tuple)):
|
||||
left = [left]
|
||||
for join in left:
|
||||
tablenames += db._adapter.tables(join)
|
||||
tables = [db[tablename] for tablename in tablenames]
|
||||
print tables
|
||||
if fields:
|
||||
# add missing tablename to virtual fields
|
||||
for table in tables:
|
||||
@@ -2749,11 +2744,7 @@ class SQLFORM(FORM):
|
||||
if field.type == 'blob':
|
||||
continue
|
||||
if isinstance(field, Field.Virtual) and field.tablename in row:
|
||||
try:
|
||||
# fast path, works for joins
|
||||
value = row[field.tablename][field.name]
|
||||
except KeyError:
|
||||
value = dbset.db[field.tablename][row[field.tablename][field_id]][field.name]
|
||||
value = dbset.db[field.tablename][row[field.tablename][field_id]][field.name]
|
||||
else:
|
||||
value = row[str(field)]
|
||||
maxlength = maxtextlengths.get(str(field), maxtextlength)
|
||||
@@ -3043,16 +3034,7 @@ class SQLFORM(FORM):
|
||||
query = query & constraints[table._tablename]
|
||||
if isinstance(links, dict):
|
||||
links = links.get(table._tablename, [])
|
||||
for key in ('fields', 'field_id', 'left', 'headers', 'orderby', 'groupby', 'searchable',
|
||||
'sortable', 'paginate', 'deletable', 'editable', 'details', 'selectable',
|
||||
'create', 'csv', 'links', 'links_in_grid', 'upload', 'maxtextlengths',
|
||||
'maxtextlength', 'onvalidation', 'onfailure', 'oncreate', 'onupdate',
|
||||
'ondelete', 'sorter_icons', 'ui', 'showbuttontext', '_class', 'formname',
|
||||
'search_widget', 'advanced_search', 'ignore_rw', 'formstyle', 'exportclasses',
|
||||
'formargs', 'createargs', 'editargs', 'viewargs', 'selectable_submit_button',
|
||||
'buttons_placement', 'links_placement', 'noconfirm', 'cache_count', 'client_side_delete',
|
||||
'ignore_common_filters', 'auto_pagination', 'use_cursor'
|
||||
):
|
||||
for key in 'columns,orderby,searchable,sortable,paginate,deletable,editable,details,selectable,create,fields'.split(','):
|
||||
if isinstance(kwargs.get(key, None), dict):
|
||||
if table._tablename in kwargs[key]:
|
||||
kwargs[key] = kwargs[key][table._tablename]
|
||||
|
||||
@@ -21,7 +21,6 @@ from test_contribs import *
|
||||
from test_web import *
|
||||
from test_dal import *
|
||||
from test_tools import *
|
||||
from test_scheduler import *
|
||||
|
||||
if sys.version[:3] == '2.7':
|
||||
from test_old_doctests import *
|
||||
|
||||
+14
-20
@@ -37,11 +37,10 @@ def tearDownModule():
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class TestCache(unittest.TestCase):
|
||||
|
||||
# TODO: test_CacheAbstract(self):
|
||||
|
||||
def test_CacheInRam(self):
|
||||
def testCacheInRam(self):
|
||||
|
||||
# defaults to mode='http'
|
||||
cache = CacheInRam()
|
||||
@@ -54,21 +53,22 @@ class TestCache(unittest.TestCase):
|
||||
cache.clear()
|
||||
self.assertEqual(cache('a', lambda: 3, 100), 3)
|
||||
self.assertEqual(cache('a', lambda: 4, 0), 4)
|
||||
# test singleton behaviour
|
||||
#test singleton behaviour
|
||||
cache = CacheInRam()
|
||||
cache.clear()
|
||||
self.assertEqual(cache('a', lambda: 3, 100), 3)
|
||||
self.assertEqual(cache('a', lambda: 4, 0), 4)
|
||||
# test key deletion
|
||||
#test key deletion
|
||||
cache('a', None)
|
||||
self.assertEqual(cache('a', lambda: 5, 100), 5)
|
||||
# test increment
|
||||
#test increment
|
||||
self.assertEqual(cache.increment('a'), 6)
|
||||
self.assertEqual(cache('a', lambda: 1, 100), 6)
|
||||
cache.increment('b')
|
||||
self.assertEqual(cache('b', lambda: 'x', 100), 1)
|
||||
|
||||
def test_CacheOnDisk(self):
|
||||
|
||||
def testCacheOnDisk(self):
|
||||
|
||||
# defaults to mode='http'
|
||||
s = Storage({'application': 'admin',
|
||||
@@ -83,36 +83,30 @@ class TestCache(unittest.TestCase):
|
||||
cache.clear()
|
||||
self.assertEqual(cache('a', lambda: 3, 100), 3)
|
||||
self.assertEqual(cache('a', lambda: 4, 0), 4)
|
||||
# test singleton behaviour
|
||||
#test singleton behaviour
|
||||
cache = CacheOnDisk(s)
|
||||
cache.clear()
|
||||
self.assertEqual(cache('a', lambda: 3, 100), 3)
|
||||
self.assertEqual(cache('a', lambda: 4, 0), 4)
|
||||
# test key deletion
|
||||
#test key deletion
|
||||
cache('a', None)
|
||||
self.assertEqual(cache('a', lambda: 5, 100), 5)
|
||||
# test increment
|
||||
#test increment
|
||||
self.assertEqual(cache.increment('a'), 6)
|
||||
self.assertEqual(cache('a', lambda: 1, 100), 6)
|
||||
cache.increment('b')
|
||||
self.assertEqual(cache('b', lambda: 'x', 100), 1)
|
||||
|
||||
# TODO: def test_CacheAction(self):
|
||||
|
||||
# TODO: def test_Cache(self):
|
||||
|
||||
# TODO: def test_lazy_cache(self):
|
||||
|
||||
def test_CacheWithPrefix(self):
|
||||
def testCacheWithPrefix(self):
|
||||
s = Storage({'application': 'admin',
|
||||
'folder': 'applications/admin'})
|
||||
cache = Cache(s)
|
||||
prefix = cache.with_prefix(cache.ram, 'prefix')
|
||||
prefix = cache.with_prefix(cache.ram,'prefix')
|
||||
self.assertEqual(prefix('a', lambda: 1, 0), 1)
|
||||
self.assertEqual(prefix('a', lambda: 2, 100), 1)
|
||||
self.assertEqual(cache.ram('prefixa', lambda: 2, 100), 1)
|
||||
|
||||
def test_Regex(self):
|
||||
def testRegex(self):
|
||||
cache = CacheInRam()
|
||||
self.assertEqual(cache('a1', lambda: 1, 0), 1)
|
||||
self.assertEqual(cache('a2', lambda: 2, 100), 2)
|
||||
@@ -120,7 +114,7 @@ class TestCache(unittest.TestCase):
|
||||
self.assertEqual(cache('a1', lambda: 2, 0), 2)
|
||||
self.assertEqual(cache('a2', lambda: 3, 100), 3)
|
||||
|
||||
def test_DALcache(self):
|
||||
def testDALcache(self):
|
||||
s = Storage({'application': 'admin',
|
||||
'folder': 'applications/admin'})
|
||||
cache = Cache(s)
|
||||
|
||||
@@ -106,18 +106,16 @@ class TestDALAdapters(unittest.TestCase):
|
||||
def test_mysql(self):
|
||||
if os.environ.get('APPVEYOR'):
|
||||
return
|
||||
if os.environ.get('TRAVIS'):
|
||||
os.environ["DB"] = "mysql://root:@localhost/pydal"
|
||||
result = self._run_tests()
|
||||
self.assertTrue(result)
|
||||
os.environ["DB"] = "mysql://root:@localhost/pydal"
|
||||
result = self._run_tests()
|
||||
self.assertTrue(result)
|
||||
|
||||
def test_pg8000(self):
|
||||
if os.environ.get('APPVEYOR'):
|
||||
return
|
||||
if os.environ.get('TRAVIS'):
|
||||
os.environ["DB"] = "postgres:pg8000://postgres:@localhost/pydal"
|
||||
result = self._run_tests()
|
||||
self.assertTrue(result)
|
||||
os.environ["DB"] = "postgres:pg8000://postgres:@localhost/pydal"
|
||||
result = self._run_tests()
|
||||
self.assertTrue(result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -12,19 +12,13 @@ from fileutils import parse_version
|
||||
|
||||
class TestFileUtils(unittest.TestCase):
|
||||
|
||||
def test_parse_version(self):
|
||||
# Legacy
|
||||
rtn = parse_version('Version 1.99.0 (2011-09-19 08:23:26)')
|
||||
self.assertEqual(rtn, (1, 99, 0, 'dev', datetime.datetime(2011, 9, 19, 8, 23, 26)))
|
||||
# Semantic
|
||||
def testParseVersion(self):
|
||||
rtn = parse_version('Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26')
|
||||
self.assertEqual(rtn, (1, 99, 0, 'rc.1', datetime.datetime(2011, 9, 19, 8, 23, 26)))
|
||||
# Semantic Stable
|
||||
rtn = parse_version('Version 2.9.11-stable+timestamp.2014.09.15.18.31.17')
|
||||
self.assertEqual(rtn, (2, 9, 11, 'stable', datetime.datetime(2014, 9, 15, 18, 31, 17)))
|
||||
# Semantic Beta
|
||||
rtn = parse_version('Version 2.14.1-beta+timestamp.2016.03.21.22.35.26')
|
||||
self.assertEqual(rtn, (2, 14, 1, 'beta', datetime.datetime(2016, 3, 21, 22, 35, 26)))
|
||||
rtn = parse_version('Version 1.99.0 (2011-09-19 08:23:26)')
|
||||
self.assertEqual(rtn, (1, 99, 0, 'dev', datetime.datetime(2011, 9, 19, 8, 23, 26)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
+319
-596
@@ -12,30 +12,314 @@ fix_sys_path(__file__)
|
||||
|
||||
from html import *
|
||||
from html import verifyURL
|
||||
from html import truncate_string
|
||||
from storage import Storage
|
||||
from html import XML_pickle, XML_unpickle
|
||||
from html import TAG_pickler, TAG_unpickler
|
||||
|
||||
|
||||
class TestBareHelpers(unittest.TestCase):
|
||||
|
||||
# xmlescape() = covered by other tests
|
||||
def testBR(self):
|
||||
self.assertEqual(BR(_a='1', _b='2').xml(), '<br a="1" b="2" />')
|
||||
|
||||
# TODO: def test_call_as_list(self):
|
||||
def testEMBED(self):
|
||||
self.assertEqual(EMBED(_a='1', _b='2').xml(),
|
||||
'<embed a="1" b="2" />')
|
||||
|
||||
def test_truncate_string(self):
|
||||
# Ascii text
|
||||
self.assertEqual(truncate_string('Lorem ipsum dolor sit amet, consectetur adipiscing elit, '
|
||||
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
||||
length=30), 'Lorem ipsum dolor sit amet,...')
|
||||
self.assertEqual(truncate_string('Short text shorter than the length parameter.', length=100),
|
||||
'Short text shorter than the length parameter.')
|
||||
# French text
|
||||
self.assertEqual(truncate_string('Un texte en français avec des accents et des caractères bizarre.', length=30),
|
||||
'Un texte en français avec d...')
|
||||
def testHR(self):
|
||||
self.assertEqual(HR(_a='1', _b='2').xml(), '<hr a="1" b="2" />')
|
||||
|
||||
def test_StaticURL(self):
|
||||
def testIMG(self):
|
||||
self.assertEqual(IMG(_a='1', _b='2').xml(),
|
||||
'<img a="1" b="2" />')
|
||||
|
||||
def testINPUT(self):
|
||||
self.assertEqual(INPUT(_a='1', _b='2').xml(),
|
||||
'<input a="1" b="2" type="text" />')
|
||||
|
||||
def testLINK(self):
|
||||
self.assertEqual(LINK(_a='1', _b='2').xml(),
|
||||
'<link a="1" b="2" />')
|
||||
|
||||
def testMETA(self):
|
||||
self.assertEqual(META(_a='1', _b='2').xml(),
|
||||
'<meta a="1" b="2" />')
|
||||
|
||||
def testA(self):
|
||||
self.assertEqual(
|
||||
A('<>', _a='1', _b='2').xml(),
|
||||
'<a a="1" b="2"><></a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', cid='b').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="GET" data-w2p_target="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', callback='b', _id='c').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" href="b" id="c">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', delete='tr').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_remove="tr">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', _id='b', target='<self>').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_target="b" id="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', component='b').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="GET" href="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', _id='b', callback='c', noconfirm=True).xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" href="c" id="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', cid='b').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="GET" data-w2p_target="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', cid='b', _disable_with='processing...').xml(),
|
||||
'<a data-w2p_disable_with="processing..." data-w2p_method="GET" data-w2p_target="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', callback='b', delete='tr', noconfirm=True, _id='c').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" data-w2p_remove="tr" href="b" id="c">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', callback='b', delete='tr', confirm='Are you sure?', _id='c').xml(),
|
||||
'<a data-w2p_confirm="Are you sure?" data-w2p_disable_with="default" data-w2p_method="POST" data-w2p_remove="tr" href="b" id="c">a</a>'
|
||||
)
|
||||
|
||||
def testB(self):
|
||||
self.assertEqual(B('<>', _a='1', _b='2').xml(),
|
||||
'<b a="1" b="2"><></b>')
|
||||
|
||||
def testBODY(self):
|
||||
self.assertEqual(BODY('<>', _a='1', _b='2').xml(),
|
||||
'<body a="1" b="2"><></body>')
|
||||
|
||||
def testCENTER(self):
|
||||
self.assertEqual(CENTER('<>', _a='1', _b='2').xml(),
|
||||
'<center a="1" b="2"><></center>')
|
||||
|
||||
def testDIV(self):
|
||||
self.assertEqual(DIV('<>', _a='1', _b='2').xml(),
|
||||
'<div a="1" b="2"><></div>')
|
||||
# attributes can be updated like in a dict
|
||||
div = DIV('<>', _a='1')
|
||||
div['_b'] = '2'
|
||||
self.assertEqual(div.xml(),
|
||||
'<div a="1" b="2"><></div>')
|
||||
# also with a mapping
|
||||
div.update(_b=2, _c=3)
|
||||
self.assertEqual(div.xml(),
|
||||
'<div a="1" b="2" c="3"><></div>')
|
||||
# length of the DIV is the number of components
|
||||
self.assertEqual(len(DIV('a', 'bc')), 2)
|
||||
# also if empty, DIV is True in a boolean evaluation
|
||||
self.assertTrue(True if DIV() else False)
|
||||
# parent and siblings
|
||||
a = DIV(SPAN('a'), DIV('b'))
|
||||
s = a.element('span')
|
||||
d = s.parent
|
||||
d['_class'] = 'abc'
|
||||
self.assertEqual(a.xml(), '<div class="abc"><span>a</span><div>b</div></div>')
|
||||
self.assertEqual([el.xml() for el in s.siblings()], ['<div>b</div>'])
|
||||
self.assertEqual(s.sibling().xml(), '<div>b</div>')
|
||||
self.assertEqual(s.siblings('a'), [])
|
||||
|
||||
def testEM(self):
|
||||
self.assertEqual(EM('<>', _a='1', _b='2').xml(),
|
||||
'<em a="1" b="2"><></em>')
|
||||
|
||||
def testFIELDSET(self):
|
||||
self.assertEqual(FIELDSET('<>', _a='1', _b='2').xml(),
|
||||
'<fieldset a="1" b="2"><></fieldset>')
|
||||
|
||||
def testFORM(self):
|
||||
self.assertEqual(FORM('<>', _a='1', _b='2').xml(),
|
||||
'<form a="1" action="#" b="2" enctype="multipart/form-data" method="post"><></form>')
|
||||
|
||||
def testH1(self):
|
||||
self.assertEqual(H1('<>', _a='1', _b='2').xml(),
|
||||
'<h1 a="1" b="2"><></h1>')
|
||||
|
||||
def testH2(self):
|
||||
self.assertEqual(H2('<>', _a='1', _b='2').xml(),
|
||||
'<h2 a="1" b="2"><></h2>')
|
||||
|
||||
def testH3(self):
|
||||
self.assertEqual(H3('<>', _a='1', _b='2').xml(),
|
||||
'<h3 a="1" b="2"><></h3>')
|
||||
|
||||
def testH4(self):
|
||||
self.assertEqual(H4('<>', _a='1', _b='2').xml(),
|
||||
'<h4 a="1" b="2"><></h4>')
|
||||
|
||||
def testH5(self):
|
||||
self.assertEqual(H5('<>', _a='1', _b='2').xml(),
|
||||
'<h5 a="1" b="2"><></h5>')
|
||||
|
||||
def testH6(self):
|
||||
self.assertEqual(H6('<>', _a='1', _b='2').xml(),
|
||||
'<h6 a="1" b="2"><></h6>')
|
||||
|
||||
def testHEAD(self):
|
||||
self.assertEqual(HEAD('<>', _a='1', _b='2').xml(),
|
||||
'<head a="1" b="2"><></head>')
|
||||
|
||||
def testHTML(self):
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2').xml(),
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html a="1" b="2" lang="en"><></html>')
|
||||
|
||||
def testIFRAME(self):
|
||||
self.assertEqual(IFRAME('<>', _a='1', _b='2').xml(),
|
||||
'<iframe a="1" b="2"><></iframe>')
|
||||
|
||||
def testLABEL(self):
|
||||
self.assertEqual(LABEL('<>', _a='1', _b='2').xml(),
|
||||
'<label a="1" b="2"><></label>')
|
||||
|
||||
def testLI(self):
|
||||
self.assertEqual(LI('<>', _a='1', _b='2').xml(),
|
||||
'<li a="1" b="2"><></li>')
|
||||
|
||||
def testOBJECT(self):
|
||||
self.assertEqual(OBJECT('<>', _a='1', _b='2').xml(),
|
||||
'<object a="1" b="2"><></object>')
|
||||
|
||||
def testOL(self):
|
||||
self.assertEqual(OL('<>', _a='1', _b='2').xml(),
|
||||
'<ol a="1" b="2"><li><></li></ol>')
|
||||
|
||||
def testOPTION(self):
|
||||
self.assertEqual(OPTION('<>', _a='1', _b='2').xml(),
|
||||
'<option a="1" b="2" value="<>"><>' +
|
||||
'</option>')
|
||||
|
||||
def testP(self):
|
||||
self.assertEqual(P('<>', _a='1', _b='2').xml(),
|
||||
'<p a="1" b="2"><></p>')
|
||||
# test cr2br
|
||||
self.assertEqual(P('a\nb').xml(), '<p>a\nb</p>')
|
||||
self.assertEqual(P('a\nb', cr2br=True).xml(), '<p>a<br />b</p>')
|
||||
|
||||
def testPRE(self):
|
||||
self.assertEqual(PRE('<>', _a='1', _b='2').xml(),
|
||||
'<pre a="1" b="2"><></pre>')
|
||||
|
||||
def testSCRIPT(self):
|
||||
self.assertEqual(SCRIPT('<>', _a='1', _b='2').xml(),
|
||||
'''<script a="1" b="2"><!--
|
||||
<>
|
||||
//--></script>''')
|
||||
self.assertEqual(SCRIPT('<>').xml(),
|
||||
'''<script><!--
|
||||
<>
|
||||
//--></script>''')
|
||||
self.assertEqual(SCRIPT().xml(), '<script></script>')
|
||||
|
||||
def testSELECT(self):
|
||||
self.assertEqual(SELECT('<>', _a='1', _b='2').xml(),
|
||||
'<select a="1" b="2">' +
|
||||
'<option value="<>"><></option></select>')
|
||||
|
||||
def testSPAN(self):
|
||||
self.assertEqual(SPAN('<>', _a='1', _b='2').xml(),
|
||||
'<span a="1" b="2"><></span>')
|
||||
|
||||
def testSTYLE(self):
|
||||
self.assertEqual(STYLE('<>', _a='1', _b='2').xml(),
|
||||
'<style a="1" b="2"><!--/*--><![CDATA[/*><!--*/\n<>\n/*]]>*/--></style>')
|
||||
|
||||
def testTABLE(self):
|
||||
self.assertEqual(TABLE('<>', _a='1', _b='2').xml(),
|
||||
'<table a="1" b="2"><tr><td><></td></tr>' +
|
||||
'</table>')
|
||||
|
||||
def testTBODY(self):
|
||||
self.assertEqual(TBODY('<>', _a='1', _b='2').xml(),
|
||||
'<tbody a="1" b="2"><tr><td><></td></tr></tbody>')
|
||||
|
||||
def testTD(self):
|
||||
self.assertEqual(TD('<>', _a='1', _b='2').xml(),
|
||||
'<td a="1" b="2"><></td>')
|
||||
|
||||
def testTEXTAREA(self):
|
||||
self.assertEqual(TEXTAREA('<>', _a='1', _b='2').xml(),
|
||||
'<textarea a="1" b="2" cols="40" rows="10"><>' +
|
||||
'</textarea>')
|
||||
# override _rows and _cols
|
||||
self.assertEqual(TEXTAREA('<>', _a='1', _b='2', _rows=5, _cols=20).xml(),
|
||||
'<textarea a="1" b="2" cols="20" rows="5"><>' +
|
||||
'</textarea>')
|
||||
|
||||
def testTFOOT(self):
|
||||
self.assertEqual(TFOOT('<>', _a='1', _b='2').xml(),
|
||||
'<tfoot a="1" b="2"><tr><td><></td></tr></tfoot>')
|
||||
|
||||
def testTH(self):
|
||||
self.assertEqual(TH('<>', _a='1', _b='2').xml(),
|
||||
'<th a="1" b="2"><></th>')
|
||||
|
||||
def testTHEAD(self):
|
||||
self.assertEqual(THEAD('<>', _a='1', _b='2').xml(),
|
||||
'<thead a="1" b="2"><tr><th><></th></tr></thead>')
|
||||
#self.assertEqual(THEAD(TRHEAD('<>'), _a='1', _b='2').xml(),
|
||||
# '<thead a="1" b="2"><tr><th><></th></tr></thead>')
|
||||
self.assertEqual(THEAD(TR('<>'), _a='1', _b='2').xml(),
|
||||
'<thead a="1" b="2"><tr><td><></td></tr></thead>')
|
||||
|
||||
def testTITLE(self):
|
||||
self.assertEqual(TITLE('<>', _a='1', _b='2').xml(),
|
||||
'<title a="1" b="2"><></title>')
|
||||
|
||||
def testTR(self):
|
||||
self.assertEqual(TR('<>', _a='1', _b='2').xml(),
|
||||
'<tr a="1" b="2"><td><></td></tr>')
|
||||
|
||||
def testTT(self):
|
||||
self.assertEqual(TT('<>', _a='1', _b='2').xml(),
|
||||
'<tt a="1" b="2"><></tt>')
|
||||
|
||||
def testUL(self):
|
||||
self.assertEqual(UL('<>', _a='1', _b='2').xml(),
|
||||
'<ul a="1" b="2"><li><></li></ul>')
|
||||
|
||||
def testXML(self):
|
||||
# sanitization process
|
||||
self.assertEqual(XML('<h1>Hello<a data-hello="world">World</a></h1>').xml(),
|
||||
'<h1>Hello<a data-hello="world">World</a></h1>')
|
||||
# with sanitize, data-attributes are not permitted
|
||||
self.assertEqual(XML('<h1>Hello<a data-hello="world">World</a></h1>', sanitize=True).xml(),
|
||||
'<h1>HelloWorld</h1>')
|
||||
# stringify by default
|
||||
self.assertEqual(XML(1.3), '1.3')
|
||||
self.assertEqual(XML(u'<div>è</div>').xml(), '<div>\xc3\xa8</div>')
|
||||
# you can calc len on the class, that equals the xml() and the str()
|
||||
self.assertEqual(len(XML('1.3')), len('1.3'))
|
||||
self.assertEqual(len(XML('1.3').xml()), len('1.3'))
|
||||
self.assertEqual(len(str(XML('1.3'))), len('1.3'))
|
||||
# you can concatenate them to strings (check for __add__ and __radd__ methods)
|
||||
self.assertEqual(XML('a') + 'b', 'ab')
|
||||
self.assertEqual(XML('a') + XML('b'), 'ab')
|
||||
self.assertEqual('a' + XML('b'), 'ab')
|
||||
# you can compare them
|
||||
self.assertEqual(XML('a') == XML('a'), True)
|
||||
# beware that the comparison is made on the XML repr
|
||||
self.assertEqual(XML('<h1>Hello<a data-hello="world">World</a></h1>', sanitize=True),
|
||||
XML('<h1>HelloWorld</h1>'))
|
||||
#bug check for the sanitizer for closing no-close tags
|
||||
self.assertEqual(XML('<p>Test</p><br/><p>Test</p><br/>', sanitize=True),
|
||||
XML('<p>Test</p><br /><p>Test</p><br />'))
|
||||
|
||||
def testTAG(self):
|
||||
self.assertEqual(TAG.first(TAG.second('test'), _key=3).xml(),
|
||||
'<first key="3"><second>test</second></first>')
|
||||
# ending in underscore "triggers" <input /> style
|
||||
self.assertEqual(TAG.first_(TAG.second('test'), _key=3).xml(),
|
||||
'<first key="3" />')
|
||||
|
||||
def testStaticURL(self):
|
||||
# test response.static_version coupled with response.static_version_urls
|
||||
self.assertEqual(URL('a', 'c', 'f'), '/a/c/f')
|
||||
self.assertEqual(URL('a', 'static', 'design.css'), '/a/static/design.css')
|
||||
@@ -47,62 +331,62 @@ class TestBareHelpers(unittest.TestCase):
|
||||
response.static_version_urls = True
|
||||
self.assertEqual(URL('a', 'static', 'design.css'), '/a/static/_1.2.3/design.css')
|
||||
|
||||
def test_URL(self):
|
||||
def testURL(self):
|
||||
self.assertEqual(URL('a', 'c', 'f', args='1'), '/a/c/f/1')
|
||||
self.assertEqual(URL('a', 'c', 'f', args=('1', '2')), '/a/c/f/1/2')
|
||||
self.assertEqual(URL('a', 'c', 'f', args=['1', '2']), '/a/c/f/1/2')
|
||||
self.assertEqual(URL('a', 'c', '/f'), '/a/c/f')
|
||||
self.assertEqual(URL('a', 'c', 'f.json'), '/a/c/f.json')
|
||||
self.assertRaises(SyntaxError, URL, *['a'])
|
||||
|
||||
request = Storage()
|
||||
request.application = 'a'
|
||||
request.controller = 'c'
|
||||
request.function = 'f'
|
||||
request.env = {}
|
||||
|
||||
from globals import current # Can't be moved with other import
|
||||
from globals import current
|
||||
current.request = request
|
||||
|
||||
must_return = '/a/c/f'
|
||||
self.assertEqual(URL(), must_return)
|
||||
self.assertEqual(URL('f'), must_return)
|
||||
self.assertEqual(URL('c', 'f'), must_return)
|
||||
self.assertEqual(URL('a', 'c', 'f'), must_return)
|
||||
self.assertEqual(URL('a', 'c', 'f', extension='json'), '/a/c/f.json')
|
||||
|
||||
def weird():
|
||||
pass
|
||||
self.assertEqual(URL('a', 'c', weird), '/a/c/weird')
|
||||
self.assertRaises(SyntaxError, URL, *['a', 'c', 1])
|
||||
# test signature
|
||||
rtn = URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
|
||||
vars={'p': (1, 3), 'q': 2}, anchor='1', hmac_key='key')
|
||||
rtn = URL(
|
||||
a='a', c='c', f='f', args=['x', 'y', 'z'],
|
||||
vars={'p': (1, 3), 'q': 2}, anchor='1', hmac_key='key'
|
||||
)
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=a32530f0d0caa80964bb92aad2bedf8a4486a31f#1')
|
||||
# test _signature exclusion
|
||||
rtn = URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
|
||||
vars={'p': (1, 3), 'q': 2, '_signature': 'abc'},
|
||||
anchor='1', hmac_key='key')
|
||||
rtn = URL(
|
||||
a='a', c='c', f='f', args=['x', 'y', 'z'],
|
||||
vars={'p': (1, 3), 'q': 2, '_signature': 'abc'},
|
||||
anchor='1', hmac_key='key'
|
||||
)
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=a32530f0d0caa80964bb92aad2bedf8a4486a31f#1')
|
||||
# emulate user_signature
|
||||
current.session = Storage(auth=Storage(hmac_key='key'))
|
||||
self.assertEqual(URL(user_signature=True), '/a/c/f?_signature=c4aed53c08cff08f369dbf8b5ba51889430cf2c2')
|
||||
# hash_vars combination
|
||||
rtn = URL('a', 'c', 'f', args=['x', 'y', 'z'], vars={'p': (1, 3), 'q': 2}, hmac_key='key')
|
||||
rtn = URL('a','c','f', args=['x', 'y', 'z'], vars={'p' : (1,3), 'q' : 2}, hmac_key='key')
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=a32530f0d0caa80964bb92aad2bedf8a4486a31f')
|
||||
rtn = URL('a', 'c', 'f', args=['x', 'y', 'z'], vars={'p': (1, 3), 'q': 2}, hmac_key='key', hash_vars=True)
|
||||
rtn = URL('a','c','f', args=['x', 'y', 'z'], vars={'p' : (1,3), 'q' : 2}, hmac_key='key', hash_vars=True)
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=a32530f0d0caa80964bb92aad2bedf8a4486a31f')
|
||||
rtn = URL('a', 'c', 'f', args=['x', 'y', 'z'], vars={'p': (1, 3), 'q': 2}, hmac_key='key', hash_vars=False)
|
||||
rtn = URL('a','c','f', args=['x', 'y', 'z'], vars={'p' : (1,3), 'q' : 2}, hmac_key='key', hash_vars=False)
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=0b5a0702039992aad23c82794b8496e5dcd59a5b')
|
||||
rtn = URL('a', 'c', 'f', args=['x', 'y', 'z'], vars={'p': (1, 3), 'q': 2}, hmac_key='key', hash_vars=['p'])
|
||||
rtn = URL('a','c','f', args=['x', 'y', 'z'], vars={'p' : (1,3), 'q' : 2}, hmac_key='key', hash_vars=['p'])
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=5d01b982fd72b39674b012e0288071034e156d7a')
|
||||
rtn = URL('a', 'c', 'f', args=['x', 'y', 'z'], vars={'p': (1, 3), 'q': 2}, hmac_key='key', hash_vars='p')
|
||||
rtn = URL('a','c','f', args=['x', 'y', 'z'], vars={'p' : (1,3), 'q' : 2}, hmac_key='key', hash_vars='p')
|
||||
self.assertEqual(rtn, '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=5d01b982fd72b39674b012e0288071034e156d7a')
|
||||
# test CRLF detection
|
||||
self.assertRaises(SyntaxError, URL, *['a\n', 'c', 'f'])
|
||||
self.assertRaises(SyntaxError, URL, *['a\r', 'c', 'f'])
|
||||
|
||||
def test_verifyURL(self):
|
||||
def testverifyURL(self):
|
||||
r = Storage()
|
||||
r.application = 'a'
|
||||
r.controller = 'c'
|
||||
@@ -145,573 +429,12 @@ class TestBareHelpers(unittest.TestCase):
|
||||
rtn = verifyURL(r, user_signature=True)
|
||||
self.assertEqual(rtn, True)
|
||||
|
||||
# TODO: def test_XmlComponent(self):
|
||||
|
||||
def test_XML(self):
|
||||
# sanitization process
|
||||
self.assertEqual(XML('<h1>Hello<a data-hello="world">World</a></h1>').xml(),
|
||||
'<h1>Hello<a data-hello="world">World</a></h1>')
|
||||
# with sanitize, data-attributes are not permitted
|
||||
self.assertEqual(XML('<h1>Hello<a data-hello="world">World</a></h1>', sanitize=True).xml(),
|
||||
'<h1>HelloWorld</h1>')
|
||||
# stringify by default
|
||||
self.assertEqual(XML(1.3), '1.3')
|
||||
self.assertEqual(XML(u'<div>è</div>').xml(), '<div>\xc3\xa8</div>')
|
||||
# you can calc len on the class, that equals the xml() and the str()
|
||||
self.assertEqual(len(XML('1.3')), len('1.3'))
|
||||
self.assertEqual(len(XML('1.3').xml()), len('1.3'))
|
||||
self.assertEqual(len(str(XML('1.3'))), len('1.3'))
|
||||
# you can concatenate them to strings (check for __add__ and __radd__ methods)
|
||||
self.assertEqual(XML('a') + 'b', 'ab')
|
||||
self.assertEqual(XML('a') + XML('b'), 'ab')
|
||||
self.assertEqual('a' + XML('b'), 'ab')
|
||||
# you can compare them
|
||||
self.assertEqual(XML('a') == XML('a'), True)
|
||||
# beware that the comparison is made on the XML repr
|
||||
self.assertEqual(XML('<h1>Hello<a data-hello="world">World</a></h1>', sanitize=True),
|
||||
XML('<h1>HelloWorld</h1>'))
|
||||
# bug check for the sanitizer for closing no-close tags
|
||||
self.assertEqual(XML('<p>Test</p><br/><p>Test</p><br/>', sanitize=True),
|
||||
XML('<p>Test</p><br /><p>Test</p><br />'))
|
||||
# basic flatten test
|
||||
self.assertEqual(XML('<p>Test</p>').flatten(), '<p>Test</p>')
|
||||
self.assertEqual(XML('<p>Test</p>').flatten(render=lambda text, tag, attr: text), '<p>Test</p>')
|
||||
|
||||
def test_XML_pickle_unpickle(self):
|
||||
# weird test
|
||||
self.assertEqual(XML_unpickle(XML_pickle('data to be pickle')[1][0]), 'data to be pickle')
|
||||
|
||||
def test_DIV(self):
|
||||
# Empty DIV()
|
||||
self.assertEqual(DIV().xml(), '<div></div>')
|
||||
self.assertEqual(DIV('<>', _a='1', _b='2').xml(),
|
||||
'<div a="1" b="2"><></div>')
|
||||
# attributes can be updated like in a dict
|
||||
div = DIV('<>', _a='1')
|
||||
div['_b'] = '2'
|
||||
self.assertEqual(div.xml(),
|
||||
'<div a="1" b="2"><></div>')
|
||||
# also with a mapping
|
||||
div.update(_b=2, _c=3)
|
||||
self.assertEqual(div.xml(),
|
||||
'<div a="1" b="2" c="3"><></div>')
|
||||
# length of the DIV is the number of components
|
||||
self.assertEqual(len(DIV('a', 'bc')), 2)
|
||||
# also if empty, DIV is True in a boolean evaluation
|
||||
self.assertTrue(True if DIV() else False)
|
||||
# parent and siblings
|
||||
a = DIV(SPAN('a'), DIV('b'))
|
||||
s = a.element('span')
|
||||
d = s.parent
|
||||
d['_class'] = 'abc'
|
||||
self.assertEqual(a.xml(), '<div class="abc"><span>a</span><div>b</div></div>')
|
||||
self.assertEqual([el.xml() for el in s.siblings()], ['<div>b</div>'])
|
||||
self.assertEqual(s.sibling().xml(), '<div>b</div>')
|
||||
# siblings with wrong args
|
||||
self.assertEqual(s.siblings('a'), [])
|
||||
# siblings with good args
|
||||
self.assertEqual(s.siblings('div')[0].xml(), '<div>b</div>')
|
||||
# Check for siblings with wrong kargs and value
|
||||
self.assertEqual(s.siblings(a='d'), [])
|
||||
# Check for siblings with good kargs and value
|
||||
# Can't figure this one out what is a right value here??
|
||||
# Commented for now...
|
||||
# self.assertEqual(s.siblings(div='<div>b</div>'), ???)
|
||||
# No other sibling should return None
|
||||
self.assertEqual(DIV(P('First element')).element('p').sibling(), None)
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# This use unicode to hit xmlescape() line :
|
||||
# """
|
||||
# elif isinstance(data, unicode):
|
||||
# data = data.encode('utf8', 'xmlcharrefreplace')
|
||||
# """
|
||||
self.assertEqual(DIV(u'Texte en français avec des caractères accentués...').xml(),
|
||||
'<div>Texte en fran\xc3\xa7ais avec des caract\xc3\xa8res accentu\xc3\xa9s...</div>')
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
self.assertEqual(DIV('Test with an ID', _id='id-of-the-element').xml(),
|
||||
'<div id="id-of-the-element">Test with an ID</div>')
|
||||
self.assertEqual(DIV().element('p'), None)
|
||||
|
||||
# Corner case for raise coverage of one line
|
||||
# I think such assert fail cause of python 2.6
|
||||
# Work under python 2.7
|
||||
# with self.assertRaises(SyntaxError) as cm:
|
||||
# DIV(BR('<>')).xml()
|
||||
# self.assertEqual(cm.exception[0], '<br/> tags cannot have components')
|
||||
|
||||
# test .get('attrib')
|
||||
self.assertEqual(DIV('<p>Test</p>', _class="class_test").get('_class'), 'class_test')
|
||||
|
||||
def test_CAT(self):
|
||||
# Empty CAT()
|
||||
self.assertEqual(CAT().xml(), '')
|
||||
# CAT('')
|
||||
self.assertEqual(CAT('').xml(), '')
|
||||
# CAT(' ')
|
||||
self.assertEqual(CAT(' ').xml(), ' ')
|
||||
|
||||
def test_TAG_pickler_unpickler(self):
|
||||
# weird test
|
||||
self.assertEqual(TAG_unpickler(TAG_pickler(TAG.div('data to be pickle'))[1][0]).xml(),
|
||||
'<div>data to be pickle</div>')
|
||||
|
||||
def test_TAG(self):
|
||||
self.assertEqual(TAG.first(TAG.second('test'), _key=3).xml(),
|
||||
'<first key="3"><second>test</second></first>')
|
||||
# ending in underscore "triggers" <input /> style
|
||||
self.assertEqual(TAG.first_(TAG.second('test'), _key=3).xml(),
|
||||
'<first key="3" />')
|
||||
# unicode test for TAG
|
||||
self.assertEqual(TAG.div(u'Texte en français avec des caractères accentués...').xml(),
|
||||
'<div>Texte en fran\xc3\xa7ais avec des caract\xc3\xa8res accentu\xc3\xa9s...</div>')
|
||||
|
||||
def test_HTML(self):
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2').xml(),
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html a="1" b="2" lang="en"><></html>')
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2', doctype='strict').xml(),
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n<html a="1" b="2" lang="en"><></html>')
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2', doctype='transitional').xml(),
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html a="1" b="2" lang="en"><></html>')
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2', doctype='frameset').xml(),
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">\n<html a="1" b="2" lang="en"><></html>')
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2', doctype='html5').xml(),
|
||||
'<!DOCTYPE HTML>\n<html a="1" b="2" lang="en"><></html>')
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2', doctype='').xml(),
|
||||
'<html a="1" b="2" lang="en"><></html>')
|
||||
self.assertEqual(HTML('<>', _a='1', _b='2', doctype='CustomDocType').xml(),
|
||||
'CustomDocType\n<html a="1" b="2" lang="en"><></html>')
|
||||
|
||||
def test_XHTML(self):
|
||||
# Empty XHTML test
|
||||
self.assertEqual(XHTML().xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"></html>')
|
||||
# Not Empty XHTML test
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2').xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2', doctype='').xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2', doctype='strict').xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2', doctype='transitional').xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2', doctype='frameset').xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2', doctype='xmlns').xml(),
|
||||
'xmlns\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
self.assertEqual(XHTML('<>', _a='1', _b='2', _xmlns='xmlns').xml(),
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html a="1" b="2" lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><></html>')
|
||||
|
||||
def test_HEAD(self):
|
||||
self.assertEqual(HEAD('<>', _a='1', _b='2').xml(),
|
||||
'<head a="1" b="2"><></head>')
|
||||
|
||||
def test_TITLE(self):
|
||||
self.assertEqual(TITLE('<>', _a='1', _b='2').xml(),
|
||||
'<title a="1" b="2"><></title>')
|
||||
|
||||
def test_META(self):
|
||||
self.assertEqual(META(_a='1', _b='2').xml(),
|
||||
'<meta a="1" b="2" />')
|
||||
|
||||
def test_LINK(self):
|
||||
self.assertEqual(LINK(_a='1', _b='2').xml(),
|
||||
'<link a="1" b="2" />')
|
||||
|
||||
def test_SCRIPT(self):
|
||||
self.assertEqual(SCRIPT('<>', _a='1', _b='2').xml(),
|
||||
'''<script a="1" b="2"><!--
|
||||
<>
|
||||
//--></script>''')
|
||||
self.assertEqual(SCRIPT('<>').xml(),
|
||||
'''<script><!--
|
||||
<>
|
||||
//--></script>''')
|
||||
self.assertEqual(SCRIPT().xml(), '<script></script>')
|
||||
|
||||
def test_STYLE(self):
|
||||
self.assertEqual(STYLE('<>', _a='1', _b='2').xml(),
|
||||
'<style a="1" b="2"><!--/*--><![CDATA[/*><!--*/\n<>\n/*]]>*/--></style>')
|
||||
# Try to hit : return DIV.xml(self)
|
||||
self.assertEqual(STYLE().xml(), '<style></style>')
|
||||
|
||||
def test_IMG(self):
|
||||
self.assertEqual(IMG(_a='1', _b='2').xml(),
|
||||
'<img a="1" b="2" />')
|
||||
|
||||
def test_SPAN(self):
|
||||
self.assertEqual(SPAN('<>', _a='1', _b='2').xml(),
|
||||
'<span a="1" b="2"><></span>')
|
||||
|
||||
def test_BODY(self):
|
||||
self.assertEqual(BODY('<>', _a='1', _b='2').xml(),
|
||||
'<body a="1" b="2"><></body>')
|
||||
|
||||
def test_H1(self):
|
||||
self.assertEqual(H1('<>', _a='1', _b='2').xml(),
|
||||
'<h1 a="1" b="2"><></h1>')
|
||||
|
||||
def test_H2(self):
|
||||
self.assertEqual(H2('<>', _a='1', _b='2').xml(),
|
||||
'<h2 a="1" b="2"><></h2>')
|
||||
|
||||
def test_H3(self):
|
||||
self.assertEqual(H3('<>', _a='1', _b='2').xml(),
|
||||
'<h3 a="1" b="2"><></h3>')
|
||||
|
||||
def test_H4(self):
|
||||
self.assertEqual(H4('<>', _a='1', _b='2').xml(),
|
||||
'<h4 a="1" b="2"><></h4>')
|
||||
|
||||
def test_H5(self):
|
||||
self.assertEqual(H5('<>', _a='1', _b='2').xml(),
|
||||
'<h5 a="1" b="2"><></h5>')
|
||||
|
||||
def test_H6(self):
|
||||
self.assertEqual(H6('<>', _a='1', _b='2').xml(),
|
||||
'<h6 a="1" b="2"><></h6>')
|
||||
|
||||
def test_P(self):
|
||||
self.assertEqual(P('<>', _a='1', _b='2').xml(),
|
||||
'<p a="1" b="2"><></p>')
|
||||
# test cr2br
|
||||
self.assertEqual(P('a\nb').xml(), '<p>a\nb</p>')
|
||||
self.assertEqual(P('a\nb', cr2br=True).xml(), '<p>a<br />b</p>')
|
||||
|
||||
def test_STRONG(self):
|
||||
self.assertEqual(STRONG('<>', _a='1', _b='2').xml(),
|
||||
'<strong a="1" b="2"><></strong>')
|
||||
|
||||
def test_B(self):
|
||||
self.assertEqual(B('<>', _a='1', _b='2').xml(),
|
||||
'<b a="1" b="2"><></b>')
|
||||
|
||||
def test_BR(self):
|
||||
# empty BR()
|
||||
self.assertEqual(BR().xml(), '<br />')
|
||||
self.assertEqual(BR(_a='1', _b='2').xml(), '<br a="1" b="2" />')
|
||||
|
||||
def test_HR(self):
|
||||
self.assertEqual(HR(_a='1', _b='2').xml(), '<hr a="1" b="2" />')
|
||||
|
||||
def test_A(self):
|
||||
self.assertEqual(
|
||||
A('<>', _a='1', _b='2').xml(),
|
||||
'<a a="1" b="2"><></a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', cid='b').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="GET" data-w2p_target="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', callback='b', _id='c').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" href="b" id="c">a</a>'
|
||||
)
|
||||
# Callback with no id trigger web2py_uuid() call
|
||||
from html import web2pyHTMLParser
|
||||
a = A('a', callback='b').xml()
|
||||
for tag in web2pyHTMLParser(a).tree.elements('a'):
|
||||
uuid_generated = tag.attributes['_id']
|
||||
self.assertEqual(a,
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" href="b" id="{id}">a</a>'.format(id=uuid_generated))
|
||||
self.assertEqual(
|
||||
A('a', delete='tr').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_remove="tr">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', _id='b', target='<self>').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_target="b" id="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', component='b').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="GET" href="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', _id='b', callback='c', noconfirm=True).xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" href="c" id="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', cid='b').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="GET" data-w2p_target="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', cid='b', _disable_with='processing...').xml(),
|
||||
'<a data-w2p_disable_with="processing..." data-w2p_method="GET" data-w2p_target="b">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', callback='b', delete='tr', noconfirm=True, _id='c').xml(),
|
||||
'<a data-w2p_disable_with="default" data-w2p_method="POST" data-w2p_remove="tr" href="b" id="c">a</a>'
|
||||
)
|
||||
self.assertEqual(
|
||||
A('a', callback='b', delete='tr', confirm='Are you sure?', _id='c').xml(),
|
||||
'<a data-w2p_confirm="Are you sure?" data-w2p_disable_with="default" data-w2p_method="POST" data-w2p_remove="tr" href="b" id="c">a</a>'
|
||||
)
|
||||
|
||||
def test_BUTTON(self):
|
||||
self.assertEqual(BUTTON('test', _type='button').xml(),
|
||||
'<button type="button">test</button>')
|
||||
|
||||
def test_EM(self):
|
||||
self.assertEqual(EM('<>', _a='1', _b='2').xml(),
|
||||
'<em a="1" b="2"><></em>')
|
||||
|
||||
def test_EMBED(self):
|
||||
self.assertEqual(EMBED(_a='1', _b='2').xml(),
|
||||
'<embed a="1" b="2" />')
|
||||
|
||||
def test_TT(self):
|
||||
self.assertEqual(TT('<>', _a='1', _b='2').xml(),
|
||||
'<tt a="1" b="2"><></tt>')
|
||||
|
||||
def test_PRE(self):
|
||||
self.assertEqual(PRE('<>', _a='1', _b='2').xml(),
|
||||
'<pre a="1" b="2"><></pre>')
|
||||
|
||||
def test_CENTER(self):
|
||||
self.assertEqual(CENTER('<>', _a='1', _b='2').xml(),
|
||||
'<center a="1" b="2"><></center>')
|
||||
|
||||
def test_CODE(self):
|
||||
self.assertEqual(CODE("print 'hello world'",
|
||||
language='python',
|
||||
link=None,
|
||||
counter=1,
|
||||
styles={},
|
||||
highlight_line=None).xml(),
|
||||
'<table><tr style="vertical-align:top;"><td style="min-width:40px; text-align: right;"><pre style="\n font-size: 11px;\n font-family: Bitstream Vera Sans Mono,monospace;\n background-color: transparent;\n margin: 0;\n padding: 5px;\n border: none;\n color: #A0A0A0;\n">1.</pre></td><td><pre style="\n font-size: 11px;\n font-family: Bitstream Vera Sans Mono,monospace;\n background-color: transparent;\n margin: 0;\n padding: 5px;\n border: none;\n overflow: auto;\n white-space: pre !important;\n"><span style="color:#185369; font-weight: bold">print </span><span style="color: #FF9966">\'hello world\'</span></pre></td></tr></table>')
|
||||
|
||||
def test_LABEL(self):
|
||||
self.assertEqual(LABEL('<>', _a='1', _b='2').xml(),
|
||||
'<label a="1" b="2"><></label>')
|
||||
|
||||
def test_LI(self):
|
||||
self.assertEqual(LI('<>', _a='1', _b='2').xml(),
|
||||
'<li a="1" b="2"><></li>')
|
||||
|
||||
def test_UL(self):
|
||||
self.assertEqual(UL('<>', _a='1', _b='2').xml(),
|
||||
'<ul a="1" b="2"><li><></li></ul>')
|
||||
|
||||
def test_OL(self):
|
||||
self.assertEqual(OL('<>', _a='1', _b='2').xml(),
|
||||
'<ol a="1" b="2"><li><></li></ol>')
|
||||
|
||||
def test_TD(self):
|
||||
self.assertEqual(TD('<>', _a='1', _b='2').xml(),
|
||||
'<td a="1" b="2"><></td>')
|
||||
|
||||
def test_TH(self):
|
||||
self.assertEqual(TH('<>', _a='1', _b='2').xml(),
|
||||
'<th a="1" b="2"><></th>')
|
||||
|
||||
def test_TR(self):
|
||||
self.assertEqual(TR('<>', _a='1', _b='2').xml(),
|
||||
'<tr a="1" b="2"><td><></td></tr>')
|
||||
|
||||
def test_THEAD(self):
|
||||
self.assertEqual(THEAD('<>', _a='1', _b='2').xml(),
|
||||
'<thead a="1" b="2"><tr><th><></th></tr></thead>')
|
||||
# self.assertEqual(THEAD(TRHEAD('<>'), _a='1', _b='2').xml(),
|
||||
# '<thead a="1" b="2"><tr><th><></th></tr></thead>')
|
||||
self.assertEqual(THEAD(TR('<>'), _a='1', _b='2').xml(),
|
||||
'<thead a="1" b="2"><tr><td><></td></tr></thead>')
|
||||
|
||||
def test_TBODY(self):
|
||||
self.assertEqual(TBODY('<>', _a='1', _b='2').xml(),
|
||||
'<tbody a="1" b="2"><tr><td><></td></tr></tbody>')
|
||||
|
||||
def test_TFOOT(self):
|
||||
self.assertEqual(TFOOT('<>', _a='1', _b='2').xml(),
|
||||
'<tfoot a="1" b="2"><tr><td><></td></tr></tfoot>')
|
||||
|
||||
def test_COL(self):
|
||||
# Empty COL test
|
||||
self.assertEqual(COL().xml(), '<col />')
|
||||
# Not Empty COL test
|
||||
self.assertEqual(COL(_span='2').xml(), '<col span="2" />')
|
||||
# Commented for now not so sure how to make it pass properly was passing locally
|
||||
# I think this test is interesting and add value
|
||||
# This fail relate to python 2.6 limitation I think
|
||||
# Failing COL test
|
||||
# with self.assertRaises(SyntaxError) as cm:
|
||||
# COL('<>').xml()
|
||||
# self.assertEqual(cm.exception[0], '<col/> tags cannot have components')
|
||||
# For now
|
||||
self.assertRaises(SyntaxError, COL, '<>')
|
||||
|
||||
def test_COLGROUP(self):
|
||||
# Empty COLGROUP test
|
||||
self.assertEqual(COLGROUP().xml(), '<colgroup></colgroup>')
|
||||
# Not Empty COLGROUP test
|
||||
self.assertEqual(COLGROUP('<>', _a='1', _b='2').xml(), '<colgroup a="1" b="2"><></colgroup>')
|
||||
|
||||
def test_TABLE(self):
|
||||
self.assertEqual(TABLE('<>', _a='1', _b='2').xml(),
|
||||
'<table a="1" b="2"><tr><td><></td></tr>' +
|
||||
'</table>')
|
||||
|
||||
def test_I(self):
|
||||
self.assertEqual(I('<>', _a='1', _b='2').xml(),
|
||||
'<i a="1" b="2"><></i>')
|
||||
|
||||
def test_IFRAME(self):
|
||||
self.assertEqual(IFRAME('<>', _a='1', _b='2').xml(),
|
||||
'<iframe a="1" b="2"><></iframe>')
|
||||
|
||||
def test_INPUT(self):
|
||||
self.assertEqual(INPUT(_a='1', _b='2').xml(), '<input a="1" b="2" type="text" />')
|
||||
# list value
|
||||
self.assertEqual(INPUT(_value=[1, 2, 3]).xml(), '<input type="text" value="[1, 2, 3]" />')
|
||||
|
||||
def test_TEXTAREA(self):
|
||||
self.assertEqual(TEXTAREA('<>', _a='1', _b='2').xml(),
|
||||
'<textarea a="1" b="2" cols="40" rows="10"><>' +
|
||||
'</textarea>')
|
||||
# override _rows and _cols
|
||||
self.assertEqual(TEXTAREA('<>', _a='1', _b='2', _rows=5, _cols=20).xml(),
|
||||
'<textarea a="1" b="2" cols="20" rows="5"><>' +
|
||||
'</textarea>')
|
||||
self.assertEqual(TEXTAREA('<>', value='bla bla bla...', _rows=10, _cols=40).xml(),
|
||||
'<textarea cols="40" rows="10">bla bla bla...</textarea>')
|
||||
|
||||
def test_OPTION(self):
|
||||
self.assertEqual(OPTION('<>', _a='1', _b='2').xml(),
|
||||
'<option a="1" b="2" value="<>"><>' +
|
||||
'</option>')
|
||||
|
||||
def test_OBJECT(self):
|
||||
self.assertEqual(OBJECT('<>', _a='1', _b='2').xml(),
|
||||
'<object a="1" b="2"><></object>')
|
||||
|
||||
def test_OPTGROUP(self):
|
||||
# Empty OPTGROUP test
|
||||
self.assertEqual(OPTGROUP().xml(),
|
||||
'<optgroup></optgroup>')
|
||||
# Not Empty OPTGROUP test
|
||||
self.assertEqual(OPTGROUP('<>', _a='1', _b='2').xml(),
|
||||
'<optgroup a="1" b="2"><option value="<>"><></option></optgroup>')
|
||||
# With an OPTION
|
||||
self.assertEqual(OPTGROUP(OPTION('Option 1', _value='1'), _label='Group 1').xml(),
|
||||
'<optgroup label="Group 1"><option value="1">Option 1</option></optgroup>')
|
||||
|
||||
def test_SELECT(self):
|
||||
self.assertEqual(SELECT('<>', _a='1', _b='2').xml(),
|
||||
'<select a="1" b="2">' +
|
||||
'<option value="<>"><></option></select>')
|
||||
self.assertEqual(SELECT(OPTION('option 1', _value='1'),
|
||||
OPTION('option 2', _value='2')).xml(),
|
||||
'<select><option value="1">option 1</option><option value="2">option 2</option></select>')
|
||||
self.assertEqual(SELECT(OPTION('option 1', _value='1', _selected='selected'),
|
||||
OPTION('option 2', _value='2'),
|
||||
_multiple='multiple').xml(),
|
||||
'<select multiple="multiple"><option selected="selected" value="1">option 1</option><option value="2">option 2</option></select>')
|
||||
# More then one select with mutilple
|
||||
self.assertEqual(SELECT(OPTION('option 1', _value='1', _selected='selected'),
|
||||
OPTION('option 2', _value='2', _selected='selected'),
|
||||
_multiple='multiple').xml(),
|
||||
'<select multiple="multiple"><option selected="selected" value="1">option 1</option><option selected="selected" value="2">option 2</option></select>'
|
||||
)
|
||||
# OPTGROUP
|
||||
self.assertEqual(SELECT(OPTGROUP(OPTION('option 1', _value='1'),
|
||||
OPTION('option 2', _value='2'),
|
||||
_label='Group 1',)).xml(),
|
||||
'<select><optgroup label="Group 1"><option value="1">option 1</option><option value="2">option 2</option></optgroup></select>')
|
||||
# List
|
||||
self.assertEqual(SELECT([1, 2, 3, 4, 5]).xml(),
|
||||
'<select><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>')
|
||||
# Tuple
|
||||
self.assertEqual(SELECT((1, 2, 3, 4, 5)).xml(),
|
||||
'<select><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>')
|
||||
# String value
|
||||
self.assertEqual(SELECT('Option 1', 'Option 2').xml(),
|
||||
'<select><option value="Option 1">Option 1</option><option value="Option 2">Option 2</option></select>')
|
||||
# list as a value
|
||||
self.assertEqual(SELECT(OPTION('option 1', _value=[1, 2, 3]),
|
||||
OPTION('option 2', _value=[4, 5, 6], _selected='selected'),
|
||||
_multiple='multiple').xml(),
|
||||
'<select multiple="multiple"><option value="[1, 2, 3]">option 1</option><option selected="selected" value="[4, 5, 6]">option 2</option></select>')
|
||||
|
||||
def test_FIELDSET(self):
|
||||
self.assertEqual(FIELDSET('<>', _a='1', _b='2').xml(),
|
||||
'<fieldset a="1" b="2"><></fieldset>')
|
||||
|
||||
def test_LEGEND(self):
|
||||
self.assertEqual(LEGEND('<>', _a='1', _b='2').xml(),
|
||||
'<legend a="1" b="2"><></legend>')
|
||||
|
||||
def test_FORM(self):
|
||||
self.assertEqual(FORM('<>', _a='1', _b='2').xml(),
|
||||
'<form a="1" action="#" b="2" enctype="multipart/form-data" method="post"><></form>')
|
||||
# These 2 crash AppVeyor and Travis with: "ImportError: No YAML serializer available"
|
||||
# self.assertEqual(FORM('<>', _a='1', _b='2').as_yaml(),
|
||||
# "accepted: null\nattributes: {_a: '1', _action: '#', _b: '2', _enctype: multipart/form-data, _method: post}\ncomponents: [<>]\nerrors: {}\nlatest: {}\nparent: null\nvars: {}\n")
|
||||
# self.assertEqual(FORM('<>', _a='1', _b='2').as_xml(),
|
||||
# '<?xml version="1.0" encoding="UTF-8"?><document><errors></errors><vars></vars><parent>None</parent><attributes><_enctype>multipart/form-data</_enctype><_action>#</_action><_b>2</_b><_a>1</_a><_method>post</_method></attributes><components><item>&lt;&gt;</item></components><accepted>None</accepted><latest></latest></document>')
|
||||
|
||||
def test_BEAUTIFY(self):
|
||||
self.assertEqual(BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml(),
|
||||
'<div><table><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style="font-weight:bold;vertical-align:top;">hello</td><td style="vertical-align:top;">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>')
|
||||
# unicode
|
||||
self.assertEqual(BEAUTIFY([P(u'àéèûôç'), 'a', 'b', {'hello': 'world'}]).xml(),
|
||||
'<div><table><tr><td><div><p>\xc3\xa0\xc3\xa9\xc3\xa8\xc3\xbb\xc3\xb4\xc3\xa7</p></div></td></tr><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style="font-weight:bold;vertical-align:top;">hello</td><td style="vertical-align:top;">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>')
|
||||
|
||||
def test_MENU(self):
|
||||
self.assertEqual(MENU([('Home', False, '/welcome/default/index', [])]).xml(),
|
||||
'<ul class="web2py-menu web2py-menu-vertical"><li class="web2py-menu-first"><a href="/welcome/default/index">Home</a></li></ul>')
|
||||
# Multiples entries menu
|
||||
self.assertEqual(MENU([('Home', False, '/welcome/default/index', []),
|
||||
('Item 1', False, '/welcome/default/func_one', []),
|
||||
('Item 2', False, '/welcome/default/func_two', []),
|
||||
('Item 3', False, '/welcome/default/func_three', []),
|
||||
('Item 4', False, '/welcome/default/func_four', [])]).xml(),
|
||||
'<ul class="web2py-menu web2py-menu-vertical"><li class="web2py-menu-first"><a href="/welcome/default/index">Home</a></li><li><a href="/welcome/default/func_one">Item 1</a></li><li><a href="/welcome/default/func_two">Item 2</a></li><li><a href="/welcome/default/func_three">Item 3</a></li><li class="web2py-menu-last"><a href="/welcome/default/func_four">Item 4</a></li></ul>'
|
||||
)
|
||||
# mobile=True
|
||||
self.assertEqual(MENU([('Home', False, '/welcome/default/index', [])], mobile=True).xml(),
|
||||
'<select class="web2py-menu web2py-menu-vertical" onchange="window.location=this.value"><option value="/welcome/default/index">Home</option></select>')
|
||||
# Multiples entries menu for mobile
|
||||
self.assertEqual(MENU([('Home', False, '/welcome/default/index', []),
|
||||
('Item 1', False, '/welcome/default/func_one', []),
|
||||
('Item 2', False, '/welcome/default/func_two', []),
|
||||
('Item 3', False, '/welcome/default/func_three', []),
|
||||
('Item 4', False, '/welcome/default/func_four', [])], mobile=True).xml(),
|
||||
'<select class="web2py-menu web2py-menu-vertical" onchange="window.location=this.value"><option value="/welcome/default/index">Home</option><option value="/welcome/default/func_one">Item 1</option><option value="/welcome/default/func_two">Item 2</option><option value="/welcome/default/func_three">Item 3</option><option value="/welcome/default/func_four">Item 4</option></select>')
|
||||
|
||||
# TODO: def test_embed64(self):
|
||||
|
||||
# TODO: def test_web2pyHTMLParser(self):
|
||||
|
||||
# TODO: def test_markdown_serializer(self):
|
||||
|
||||
# TODO: def test_markmin_serializer(self):
|
||||
|
||||
def test_MARKMIN(self):
|
||||
# This test pass with python 2.7 but expected to fail under 2.6
|
||||
# with self.assertRaises(TypeError) as cm:
|
||||
# MARKMIN().xml()
|
||||
# self.assertEqual(cm.exception[0], '__init__() takes at least 2 arguments (1 given)')
|
||||
# For now
|
||||
self.assertRaises(TypeError, MARKMIN)
|
||||
self.assertEqual(MARKMIN('').xml(), '')
|
||||
self.assertEqual(MARKMIN('<>').xml(),
|
||||
'<p><></p>')
|
||||
self.assertEqual(MARKMIN("``hello_world = 'Hello World!'``:python").xml(),
|
||||
'<code class="python">hello_world = \'Hello World!\'</code>')
|
||||
self.assertEqual(MARKMIN('<>').flatten(), '<>')
|
||||
|
||||
def test_ASSIGNJS(self):
|
||||
# empty assignation
|
||||
self.assertEqual(ASSIGNJS().xml(), '')
|
||||
# text assignation
|
||||
self.assertEqual(ASSIGNJS(var1='1', var2='2').xml(), 'var var1 = "1";\nvar var2 = "2";\n')
|
||||
# int assignation
|
||||
self.assertEqual(ASSIGNJS(var1=1, var2=2).xml(), 'var var1 = 1;\nvar var2 = 2;\n')
|
||||
|
||||
|
||||
class TestData(unittest.TestCase):
|
||||
|
||||
def test_Adata(self):
|
||||
def testAdata(self):
|
||||
self.assertEqual(A('<>', data=dict(abc='<def?asd>', cde='standard'), _a='1', _b='2').xml(),
|
||||
'<a a="1" b="2" data-abc="<def?asd>" data-cde="standard"><></a>')
|
||||
'<a a="1" b="2" data-abc="<def?asd>" data-cde="standard"><></a>')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# TODO : I think we should continue to use pathoc (http://pathod.net/docs/pathoc) for tests but integrate the call in
|
||||
# gluon/tests so they run automatically. No need to make our own tests.
|
||||
# ref: https://groups.google.com/d/msg/web2py-developers/Cjye8_hXZk8/AXbftS3sCgAJ
|
||||
@@ -1,354 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Unit tests for gluon.scheduler
|
||||
"""
|
||||
import os
|
||||
import unittest
|
||||
import glob
|
||||
import datetime
|
||||
import sys
|
||||
from fix_path import fix_sys_path
|
||||
|
||||
|
||||
fix_sys_path(__file__)
|
||||
|
||||
from gluon.storage import Storage
|
||||
from gluon.languages import translator
|
||||
from gluon.scheduler import JobGraph, Scheduler
|
||||
from gluon.dal import DAL
|
||||
|
||||
|
||||
class BaseTestScheduler(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = None
|
||||
self.cleanfolder()
|
||||
from gluon import current
|
||||
s = Storage({'application': 'welcome',
|
||||
'folder': 'applications/welcome',
|
||||
'controller': 'default'})
|
||||
current.request = s
|
||||
T = translator('', 'en')
|
||||
current.T = T
|
||||
self.db = DAL('sqlite://dummy2.db', check_reserved=['all'])
|
||||
|
||||
def cleanfolder(self):
|
||||
if self.db:
|
||||
self.db.close()
|
||||
try:
|
||||
os.unlink('dummy2.db')
|
||||
except:
|
||||
pass
|
||||
tfiles = glob.glob('*_scheduler*.table')
|
||||
for a in tfiles:
|
||||
os.unlink(a)
|
||||
|
||||
def tearDown(self):
|
||||
self.cleanfolder()
|
||||
try:
|
||||
self.inner_teardown()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
class TestsForJobGraph(BaseTestScheduler):
|
||||
|
||||
def testJobGraph(self):
|
||||
s = Scheduler(self.db)
|
||||
myjob = JobGraph(self.db, 'job_1')
|
||||
fname = 'foo'
|
||||
# We have a few items to wear, and there's an "order" to respect...
|
||||
# Items are: watch, jacket, shirt, tie, pants, undershorts, belt, shoes, socks
|
||||
# Now, we can't put on the tie without wearing the shirt first, etc...
|
||||
watch = s.queue_task(fname, task_name='watch')
|
||||
jacket = s.queue_task(fname, task_name='jacket')
|
||||
shirt = s.queue_task(fname, task_name='shirt')
|
||||
tie = s.queue_task(fname, task_name='tie')
|
||||
pants = s.queue_task(fname, task_name='pants')
|
||||
undershorts = s.queue_task(fname, task_name='undershorts')
|
||||
belt = s.queue_task(fname, task_name='belt')
|
||||
shoes = s.queue_task(fname, task_name='shoes')
|
||||
socks = s.queue_task(fname, task_name='socks')
|
||||
# before the tie, comes the shirt
|
||||
myjob.add_deps(tie.id, shirt.id)
|
||||
# before the belt too comes the shirt
|
||||
myjob.add_deps(belt.id, shirt.id)
|
||||
# before the jacket, comes the tie
|
||||
myjob.add_deps(jacket.id, tie.id)
|
||||
# before the belt, come the pants
|
||||
myjob.add_deps(belt.id, pants.id)
|
||||
# before the shoes, comes the pants
|
||||
myjob.add_deps(shoes.id, pants.id)
|
||||
# before the pants, comes the undershorts
|
||||
myjob.add_deps(pants.id, undershorts.id)
|
||||
# before the shoes, comes the undershorts
|
||||
myjob.add_deps(shoes.id, undershorts.id)
|
||||
# before the jacket, comes the belt
|
||||
myjob.add_deps(jacket.id, belt.id)
|
||||
# before the shoes, comes the socks
|
||||
myjob.add_deps(shoes.id, socks.id)
|
||||
|
||||
## results in the following topological sort
|
||||
# 9,3,6 --> 4,5 --> 8,7 --> 2
|
||||
# socks, shirt, undershorts
|
||||
# tie, pants
|
||||
# shoes, belt
|
||||
# jacket
|
||||
known_toposort = [
|
||||
set([socks.id, shirt.id, undershorts.id]),
|
||||
set([tie.id, pants.id]),
|
||||
set([shoes.id, belt.id]),
|
||||
set([jacket.id])
|
||||
]
|
||||
toposort = myjob.validate('job_1')
|
||||
self.assertEqual(toposort, known_toposort)
|
||||
# add a cyclic dependency, jacket to undershorts
|
||||
myjob.add_deps(undershorts.id, jacket.id)
|
||||
# no exceptions raised, but result None
|
||||
self.assertEqual(myjob.validate('job_1'), None)
|
||||
|
||||
def testJobGraphFailing(self):
|
||||
s = Scheduler(self.db)
|
||||
myjob = JobGraph(self.db, 'job_1')
|
||||
fname = 'foo'
|
||||
# We have a few items to wear, and there's an "order" to respect...
|
||||
# Items are: watch, jacket, shirt, tie, pants, undershorts, belt, shoes, socks
|
||||
# Now, we can't put on the tie without wearing the shirt first, etc...
|
||||
watch = s.queue_task(fname, task_name='watch')
|
||||
jacket = s.queue_task(fname, task_name='jacket')
|
||||
shirt = s.queue_task(fname, task_name='shirt')
|
||||
tie = s.queue_task(fname, task_name='tie')
|
||||
pants = s.queue_task(fname, task_name='pants')
|
||||
undershorts = s.queue_task(fname, task_name='undershorts')
|
||||
belt = s.queue_task(fname, task_name='belt')
|
||||
shoes = s.queue_task(fname, task_name='shoes')
|
||||
socks = s.queue_task(fname, task_name='socks')
|
||||
# before the tie, comes the shirt
|
||||
myjob.add_deps(tie.id, shirt.id)
|
||||
# before the belt too comes the shirt
|
||||
myjob.add_deps(belt.id, shirt.id)
|
||||
# before the jacket, comes the tie
|
||||
myjob.add_deps(jacket.id, tie.id)
|
||||
# before the belt, come the pants
|
||||
myjob.add_deps(belt.id, pants.id)
|
||||
# before the shoes, comes the pants
|
||||
myjob.add_deps(shoes.id, pants.id)
|
||||
# before the pants, comes the undershorts
|
||||
myjob.add_deps(pants.id, undershorts.id)
|
||||
# before the shoes, comes the undershorts
|
||||
myjob.add_deps(shoes.id, undershorts.id)
|
||||
# before the jacket, comes the belt
|
||||
myjob.add_deps(jacket.id, belt.id)
|
||||
# before the shoes, comes the socks
|
||||
myjob.add_deps(shoes.id, socks.id)
|
||||
# add a cyclic dependency, jacket to undershorts
|
||||
myjob.add_deps(undershorts.id, jacket.id)
|
||||
# no exceptions raised, but result None
|
||||
self.assertEqual(myjob.validate('job_1'), None)
|
||||
# and no deps added
|
||||
deps_inserted = self.db(self.db.scheduler_task_deps.id>0).count()
|
||||
self.assertEqual(deps_inserted, 0)
|
||||
|
||||
def testJobGraphDifferentJobs(self):
|
||||
s = Scheduler(self.db)
|
||||
myjob1 = JobGraph(self.db, 'job_1')
|
||||
myjob2 = JobGraph(self.db, 'job_2')
|
||||
fname = 'foo'
|
||||
# We have a few items to wear, and there's an "order" to respect...
|
||||
# Items are: watch, jacket, shirt, tie, pants, undershorts, belt, shoes, socks
|
||||
# Now, we can't put on the tie without wearing the shirt first, etc...
|
||||
watch = s.queue_task(fname, task_name='watch')
|
||||
jacket = s.queue_task(fname, task_name='jacket')
|
||||
shirt = s.queue_task(fname, task_name='shirt')
|
||||
tie = s.queue_task(fname, task_name='tie')
|
||||
pants = s.queue_task(fname, task_name='pants')
|
||||
undershorts = s.queue_task(fname, task_name='undershorts')
|
||||
belt = s.queue_task(fname, task_name='belt')
|
||||
shoes = s.queue_task(fname, task_name='shoes')
|
||||
socks = s.queue_task(fname, task_name='socks')
|
||||
# before the tie, comes the shirt
|
||||
myjob1.add_deps(tie.id, shirt.id)
|
||||
# before the belt too comes the shirt
|
||||
myjob1.add_deps(belt.id, shirt.id)
|
||||
# before the jacket, comes the tie
|
||||
myjob1.add_deps(jacket.id, tie.id)
|
||||
# before the belt, come the pants
|
||||
myjob1.add_deps(belt.id, pants.id)
|
||||
# before the shoes, comes the pants
|
||||
myjob2.add_deps(shoes.id, pants.id)
|
||||
# before the pants, comes the undershorts
|
||||
myjob2.add_deps(pants.id, undershorts.id)
|
||||
# before the shoes, comes the undershorts
|
||||
myjob2.add_deps(shoes.id, undershorts.id)
|
||||
# before the jacket, comes the belt
|
||||
myjob2.add_deps(jacket.id, belt.id)
|
||||
# before the shoes, comes the socks
|
||||
myjob2.add_deps(shoes.id, socks.id)
|
||||
# every job by itself can be completed
|
||||
self.assertNotEqual(myjob1.validate('job_1'), None)
|
||||
self.assertNotEqual(myjob1.validate('job_2'), None)
|
||||
# and, implicitly, every queued task can be too
|
||||
self.assertNotEqual(myjob1.validate(), None)
|
||||
# add a cyclic dependency, jacket to undershorts
|
||||
myjob2.add_deps(undershorts.id, jacket.id)
|
||||
# every job can still be completed by itself
|
||||
self.assertNotEqual(myjob1.validate('job_1'), None)
|
||||
self.assertNotEqual(myjob1.validate('job_2'), None)
|
||||
# but trying to see if every task will ever be completed fails
|
||||
self.assertEqual(myjob2.validate(), None)
|
||||
|
||||
|
||||
class TestsForSchedulerAPIs(BaseTestScheduler):
|
||||
|
||||
def testQueue_Task(self):
|
||||
|
||||
def isnotqueued(result):
|
||||
self.assertEqual(result.id, None)
|
||||
self.assertEqual(result.uuid, None)
|
||||
self.assertEqual(len(result.errors.keys()) > 0, True)
|
||||
|
||||
def isqueued(result):
|
||||
self.assertNotEqual(result.id, None)
|
||||
self.assertNotEqual(result.uuid, None)
|
||||
self.assertEqual(len(result.errors.keys()), 0)
|
||||
|
||||
s = Scheduler(self.db)
|
||||
fname = 'foo'
|
||||
watch = s.queue_task(fname, task_name='watch')
|
||||
# queuing a task returns id, errors, uuid
|
||||
self.assertEqual(set(watch.keys()), set(['id', 'uuid', 'errors']))
|
||||
# queueing nothing isn't allowed
|
||||
self.assertRaises(TypeError, s.queue_task, *[])
|
||||
# passing pargs and pvars wrongly
|
||||
# # pargs as dict
|
||||
isnotqueued(s.queue_task(fname, dict(a=1), dict(b=1)))
|
||||
# # pvars as list
|
||||
isnotqueued(s.queue_task(fname, ['foo', 'bar'], ['foo', 'bar']))
|
||||
# two tasks with the same uuid won't be there
|
||||
isqueued(s.queue_task(fname, uuid='a'))
|
||||
isnotqueued(s.queue_task(fname, uuid='a'))
|
||||
# # #FIXME add here every parameter
|
||||
|
||||
def testTask_Status(self):
|
||||
s = Scheduler(self.db)
|
||||
fname = 'foo'
|
||||
watch = s.queue_task(fname, task_name='watch')
|
||||
# fetch status by id
|
||||
by_id = s.task_status(watch.id)
|
||||
# fetch status by uuid
|
||||
by_uuid = s.task_status(watch.uuid)
|
||||
# fetch status by query
|
||||
by_query = s.task_status(self.db.scheduler_task.function_name == 'foo')
|
||||
self.assertEqual(by_id, by_uuid)
|
||||
self.assertEqual(by_id, by_query)
|
||||
# fetch status by anything else throws
|
||||
self.assertRaises(SyntaxError, s.task_status, *[[1, 2]])
|
||||
# adding output returns the joined set, plus "result"
|
||||
rtn = s.task_status(watch.id, output=True)
|
||||
self.assertEqual(set(rtn.keys()), set(['scheduler_run', 'scheduler_task', 'result']))
|
||||
|
||||
|
||||
class testForSchedulerRunnerBase(BaseTestScheduler):
|
||||
|
||||
def inner_teardown(self):
|
||||
from gluon import current
|
||||
fdest = os.path.join(current.request.folder, 'models', 'scheduler.py')
|
||||
os.unlink(fdest)
|
||||
|
||||
def writefunction(self, content, initlines=None):
|
||||
from gluon import current
|
||||
fdest = os.path.join(current.request.folder, 'models', 'scheduler.py')
|
||||
if initlines is None:
|
||||
initlines = """
|
||||
import os
|
||||
import time
|
||||
from gluon.scheduler import Scheduler
|
||||
db_dal = os.path.abspath(os.path.join(request.folder, '..', '..', 'dummy2.db'))
|
||||
sched_dal = DAL('sqlite://%s' % db_dal, folder=os.path.dirname(db_dal))
|
||||
sched = Scheduler(sched_dal, max_empty_runs=20, migrate=False, heartbeat=1)
|
||||
"""
|
||||
with open(fdest, 'w') as q:
|
||||
q.write(initlines)
|
||||
q.write(content)
|
||||
|
||||
def exec_sched(self):
|
||||
import subprocess
|
||||
call_args = [sys.executable, 'web2py.py', '-K', 'welcome']
|
||||
ret = subprocess.call(call_args, env=dict(os.environ))
|
||||
return ret
|
||||
|
||||
|
||||
class TestsForSchedulerRunner(testForSchedulerRunnerBase):
|
||||
|
||||
def testBasic(self):
|
||||
s = Scheduler(self.db)
|
||||
foo = s.queue_task('foo')
|
||||
self.db.commit()
|
||||
self.writefunction(r"""
|
||||
def foo():
|
||||
return 'a'
|
||||
""")
|
||||
ret = self.exec_sched()
|
||||
# process finished just fine
|
||||
self.assertEqual(ret, 0)
|
||||
info = s.task_status(foo.id, output=True)
|
||||
self.assertEqual(info.result, 'a')
|
||||
|
||||
def testRetryFailed(self):
|
||||
s = Scheduler(self.db)
|
||||
failed = s.queue_task('demo2', retry_failed=1, period=5)
|
||||
failed_consecutive = s.queue_task('demo8', retry_failed=2, repeats=2, period=5)
|
||||
self.db.commit()
|
||||
self.writefunction(r"""
|
||||
|
||||
def demo2():
|
||||
1/0
|
||||
|
||||
def demo8():
|
||||
placeholder = os.path.join(request.folder, 'private', 'demo8.pholder')
|
||||
with open(placeholder, 'a') as g:
|
||||
g.write('\nplaceholder for demo8 created')
|
||||
num_of_lines = 0
|
||||
with open(placeholder) as f:
|
||||
num_of_lines = len([a for a in f.read().split('\n') if a])
|
||||
print 'number of lines', num_of_lines
|
||||
if num_of_lines <= 2:
|
||||
1/0
|
||||
else:
|
||||
os.unlink(placeholder)
|
||||
return 1
|
||||
""")
|
||||
ret = self.exec_sched()
|
||||
# process finished just fine
|
||||
self.assertEqual(ret, 0)
|
||||
# failed - checks
|
||||
info = s.task_status(failed.id)
|
||||
task_runs = self.db(self.db.scheduler_run.task_id == info.id).select()
|
||||
res = [
|
||||
("task status failed", info.status == 'FAILED'),
|
||||
("task times_run is 0", info.times_run == 0),
|
||||
("task times_failed is 2", info.times_failed == 2),
|
||||
("task ran 2 times only", len(task_runs) == 2),
|
||||
("scheduler_run records are FAILED", (task_runs[0].status == task_runs[1].status == 'FAILED')),
|
||||
("period is respected", (task_runs[1].start_time > task_runs[0].start_time + datetime.timedelta(seconds=info.period)))
|
||||
]
|
||||
for a in res:
|
||||
self.assertEqual(a[1], True, msg=a[0])
|
||||
|
||||
# failed consecutive - checks
|
||||
info = s.task_status(failed_consecutive.id)
|
||||
task_runs = self.db(self.db.scheduler_run.task_id == info.id).select()
|
||||
res = [
|
||||
("task status completed", info.status == 'COMPLETED'),
|
||||
("task times_run is 2", info.times_run == 2),
|
||||
("task times_failed is 0", info.times_failed == 0),
|
||||
("task ran 6 times", len(task_runs) == 6),
|
||||
("scheduler_run records for COMPLETED is 2", len([run.status for run in task_runs if run.status == 'COMPLETED']) == 2),
|
||||
("scheduler_run records for FAILED is 4", len([run.status for run in task_runs if run.status == 'FAILED']) == 4),
|
||||
]
|
||||
for a in res:
|
||||
self.assertEqual(a[1], True, msg=a[0])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
File diff suppressed because one or more lines are too long
@@ -9,11 +9,10 @@ from fix_path import fix_sys_path
|
||||
|
||||
fix_sys_path(__file__)
|
||||
|
||||
import template
|
||||
from template import render
|
||||
|
||||
|
||||
class TestTemplate(unittest.TestCase):
|
||||
class TestVirtualFields(unittest.TestCase):
|
||||
|
||||
def testRun(self):
|
||||
self.assertEqual(render(content='{{for i in range(n):}}{{=i}}{{pass}}',
|
||||
@@ -62,80 +61,6 @@ class TestTemplate(unittest.TestCase):
|
||||
self.assertRaises(
|
||||
SyntaxError, render, content='{{pass\n=list((1,2,\n3))}}')
|
||||
|
||||
def testWithDummyFileSystem(self):
|
||||
from os.path import join as pjoin
|
||||
import contextlib
|
||||
from StringIO import StringIO
|
||||
from gluon.restricted import RestrictedError
|
||||
|
||||
@contextlib.contextmanager
|
||||
def monkey_patch(module, fn_name, patch):
|
||||
try:
|
||||
unpatch = getattr(module, fn_name)
|
||||
except AttributeError:
|
||||
unpatch = None
|
||||
setattr(module, fn_name, patch)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
if unpatch is None:
|
||||
delattr(module, fn_name)
|
||||
else:
|
||||
setattr(module, fn_name, unpatch)
|
||||
|
||||
def dummy_open(path, mode):
|
||||
if path == pjoin('views', 'layout.html'):
|
||||
return StringIO("{{block left_sidebar}}left{{end}}"
|
||||
"{{include}}"
|
||||
"{{block right_sidebar}}right{{end}}")
|
||||
elif path == pjoin('views', 'layoutbrackets.html'):
|
||||
return StringIO("[[block left_sidebar]]left[[end]]"
|
||||
"[[include]]"
|
||||
"[[block right_sidebar]]right[[end]]")
|
||||
elif path == pjoin('views', 'default', 'index.html'):
|
||||
return StringIO("{{extend 'layout.html'}}"
|
||||
"{{block left_sidebar}}{{super}} {{end}}"
|
||||
"to"
|
||||
"{{block right_sidebar}} {{super}}{{end}}")
|
||||
elif path == pjoin('views', 'default', 'indexbrackets.html'):
|
||||
return StringIO("[[extend 'layoutbrackets.html']]"
|
||||
"[[block left_sidebar]][[super]] [[end]]"
|
||||
"to"
|
||||
"[[block right_sidebar]] [[super]][[end]]")
|
||||
elif path == pjoin('views', 'default', 'missing.html'):
|
||||
return StringIO("{{extend 'wut'}}"
|
||||
"{{block left_sidebar}}{{super}} {{end}}"
|
||||
"to"
|
||||
"{{block right_sidebar}} {{super}}{{end}}")
|
||||
elif path == pjoin('views', 'default', 'noescape.html'):
|
||||
return StringIO("""{{=NOESCAPE('<script></script>')}}""")
|
||||
raise IOError
|
||||
|
||||
with monkey_patch(template, 'open', dummy_open):
|
||||
self.assertEqual(
|
||||
render(filename=pjoin('views', 'default', 'index.html'),
|
||||
path='views'),
|
||||
'left to right')
|
||||
self.assertEqual(
|
||||
render(filename=pjoin('views', 'default', 'indexbrackets.html'),
|
||||
path='views', delimiters=('[[', ']]')),
|
||||
'left to right')
|
||||
self.assertRaises(
|
||||
RestrictedError,
|
||||
render,
|
||||
filename=pjoin('views', 'default', 'missing.html'),
|
||||
path='views')
|
||||
response = template.DummyResponse()
|
||||
response.delimiters = ('[[', ']]')
|
||||
self.assertEqual(
|
||||
render(filename=pjoin('views', 'default', 'indexbrackets.html'),
|
||||
path='views', context={'response': response}),
|
||||
'left to right')
|
||||
self.assertEqual(
|
||||
render(filename=pjoin('views', 'default', 'noescape.html'),
|
||||
context={'NOESCAPE': template.NOESCAPE}),
|
||||
'<script></script>')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
+21
-414
@@ -6,7 +6,6 @@
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import smtplib
|
||||
if sys.version < "2.7":
|
||||
import unittest2 as unittest
|
||||
else:
|
||||
@@ -20,7 +19,7 @@ DEFAULT_URI = os.getenv('DB', 'sqlite:memory')
|
||||
|
||||
from gluon.dal import DAL, Field
|
||||
from pydal.objects import Table
|
||||
from tools import Auth, Mail, Recaptcha, Recaptcha2
|
||||
from tools import Auth
|
||||
from gluon.globals import Request, Response, Session
|
||||
from storage import Storage
|
||||
from languages import translator
|
||||
@@ -29,209 +28,11 @@ from gluon.http import HTTP
|
||||
python_version = sys.version[:3]
|
||||
IS_IMAP = "imap" in DEFAULT_URI
|
||||
|
||||
|
||||
class TestMail(unittest.TestCase):
|
||||
"""
|
||||
Test the Mail class.
|
||||
"""
|
||||
|
||||
class Message(object):
|
||||
|
||||
def __init__(self, sender, to, payload):
|
||||
self.sender = sender
|
||||
self.to = to
|
||||
self.payload = payload
|
||||
self._parsed_payload = None
|
||||
|
||||
@property
|
||||
def parsed_payload(self):
|
||||
if self._parsed_payload is None:
|
||||
import email
|
||||
self._parsed_payload = email.message_from_string(self.payload)
|
||||
return self._parsed_payload
|
||||
|
||||
class DummySMTP(object):
|
||||
"""
|
||||
Dummy smtp server
|
||||
|
||||
NOTE: Test methods should take care of always leaving inbox and users empty when they finish.
|
||||
"""
|
||||
inbox = []
|
||||
users = {}
|
||||
|
||||
def __init__(self, address, port, **kwargs):
|
||||
self.address = address
|
||||
self.port = port
|
||||
self.has_quit = False
|
||||
self.tls = False
|
||||
|
||||
def login(self, username, password):
|
||||
if username not in self.users or self.users[username] != password:
|
||||
raise smtplib.SMTPAuthenticationError
|
||||
self.username = username
|
||||
self.password = password
|
||||
|
||||
def sendmail(self, sender, to, payload):
|
||||
self.inbox.append(TestMail.Message(sender, to, payload))
|
||||
|
||||
def quit(self):
|
||||
self.has_quit = True
|
||||
|
||||
def ehlo(self, hostname=None):
|
||||
pass
|
||||
|
||||
def starttls(self):
|
||||
self.tls = True
|
||||
|
||||
def setUp(self):
|
||||
self.original_SMTP = smtplib.SMTP
|
||||
self.original_SMTP_SSL = smtplib.SMTP_SSL
|
||||
smtplib.SMTP = TestMail.DummySMTP
|
||||
smtplib.SMTP_SSL = TestMail.DummySMTP
|
||||
|
||||
def tearDown(self):
|
||||
smtplib.SMTP = self.original_SMTP
|
||||
smtplib.SMTP_SSL = self.original_SMTP_SSL
|
||||
|
||||
def test_hello_world(self):
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
# If reply_to is omitted, then mail.settings.sender is used
|
||||
reply_to='us@example.com',
|
||||
message='world'))
|
||||
message = TestMail.DummySMTP.inbox.pop()
|
||||
self.assertEqual(message.sender, mail.settings.sender)
|
||||
self.assertEqual(message.to, ['somebody@example.com'])
|
||||
header = "To: somebody@example.com\nReply-To: us@example.com\nSubject: hello\n"
|
||||
self.assertTrue(header in message.payload)
|
||||
self.assertTrue(message.payload.endswith('world'))
|
||||
|
||||
def test_failed_login(self):
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
mail.settings.login = 'username:password'
|
||||
self.assertFalse(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
# If reply_to is omitted, then mail.settings.sender is used
|
||||
reply_to='us@example.com',
|
||||
message='world'))
|
||||
|
||||
def test_login(self):
|
||||
TestMail.DummySMTP.users['username'] = 'password'
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
mail.settings.login = 'username:password'
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
# If reply_to is omitted, then mail.settings.sender is used
|
||||
reply_to='us@example.com',
|
||||
message='world'))
|
||||
del TestMail.DummySMTP.users['username']
|
||||
TestMail.DummySMTP.inbox.pop()
|
||||
|
||||
def test_html(self):
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
# If reply_to is omitted, then mail.settings.sender is used
|
||||
reply_to='us@example.com',
|
||||
message='<html><head></head><body></body></html>'))
|
||||
message = TestMail.DummySMTP.inbox.pop()
|
||||
self.assertTrue('Content-Type: text/html' in message.payload)
|
||||
|
||||
def test_alternative(self):
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
message=('Text only', '<html><pre>HTML Only</pre></html>')))
|
||||
message = TestMail.DummySMTP.inbox.pop()
|
||||
self.assertTrue(message.parsed_payload.is_multipart())
|
||||
self.assertTrue(message.parsed_payload.get_content_type() == 'multipart/alternative')
|
||||
parts = message.parsed_payload.get_payload()
|
||||
self.assertTrue('Text only' in parts[0].as_string())
|
||||
self.assertTrue('<html><pre>HTML Only</pre></html>' in parts[1].as_string())
|
||||
|
||||
def test_ssl(self):
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
mail.settings.ssl = True
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
# If reply_to is omitted, then mail.settings.sender is used
|
||||
reply_to='us@example.com',
|
||||
message='world'))
|
||||
TestMail.DummySMTP.inbox.pop()
|
||||
|
||||
def test_tls(self):
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
mail.settings.tls = True
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
# If reply_to is omitted, then mail.settings.sender is used
|
||||
reply_to='us@example.com',
|
||||
message='world'))
|
||||
TestMail.DummySMTP.inbox.pop()
|
||||
|
||||
def test_attachment(self):
|
||||
module_file = os.path.abspath(__file__)
|
||||
mail = Mail()
|
||||
mail.settings.server = 'smtp.example.com:25'
|
||||
mail.settings.sender = 'you@example.com'
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
message='world',
|
||||
attachments=Mail.Attachment(module_file)))
|
||||
message = TestMail.DummySMTP.inbox.pop()
|
||||
attachment = message.parsed_payload.get_payload(1).get_payload(decode=True)
|
||||
with open(module_file, 'rb') as mf:
|
||||
self.assertEqual(attachment.decode('utf-8'), mf.read().decode('utf-8'))
|
||||
# Test missing attachment name error
|
||||
stream = open(module_file)
|
||||
self.assertRaises(Exception, lambda *args, **kwargs: Mail.Attachment(*args, **kwargs), stream)
|
||||
stream.close()
|
||||
# Test you can define content-id and content type
|
||||
self.assertTrue(mail.send(to=['somebody@example.com'],
|
||||
subject='hello',
|
||||
message='world',
|
||||
attachments=Mail.Attachment(module_file, content_id='trololo', content_type='tra/lala')))
|
||||
message = TestMail.DummySMTP.inbox.pop()
|
||||
self.assertTrue('Content-Type: tra/lala' in message.payload)
|
||||
self.assertTrue('Content-Id: <trololo>' in message.payload)
|
||||
|
||||
|
||||
# class TestRecaptcha(unittest.TestCase):
|
||||
# def test_Recaptcha(self):
|
||||
# from html import FORM
|
||||
# form = FORM(Recaptcha(public_key='public_key', private_key='private_key'))
|
||||
# self.assertEqual(form.xml(),
|
||||
# '<form action="#" enctype="multipart/form-data" method="post"><div id="recaptcha"><script><!--\nvar RecaptchaOptions = {};\n//--></script><script src="http://www.google.com/recaptcha/api/challenge?k=public_key" type="text/javascript"></script><noscript><iframe frameborder="0" height="300" src="http://www.google.com/recaptcha/api/noscript?k=public_key" width="500"></iframe><br /><input name="recaptcha_response_field" type="hidden" value="manual_challenge" /></noscript></div></form>')
|
||||
#
|
||||
#
|
||||
# class TestRecaptcha2(unittest.TestCase):
|
||||
# def test_Recaptcha2(self):
|
||||
# from html import FORM
|
||||
# form = FORM(Recaptcha2(public_key='public_key', private_key='private_key'))
|
||||
# rtn = '<form action="#" enctype="multipart/form-data" method="post"><div><script async="" defer="" src="https://www.google.com/recaptcha/api.js"></script><div class="g-recaptcha" data-sitekey="public_key"></div><noscript>\n<div style="width: 302px; height: 352px;">\n<div style="width: 302px; height: 352px; position: relative;">\n <div style="width: 302px; height: 352px; position: absolute;">\n <iframe src="https://www.google.com/recaptcha/api/fallback?k=public_key"\n frameborder="0" scrolling="no"\n style="width: 302px; height:352px; border-style: none;">\n </iframe>\n </div>\n <div style="width: 250px; height: 80px; position: absolute; border-style: none;\n bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">\n <textarea id="g-recaptcha-response" name="g-recaptcha-response"\n class="g-recaptcha-response"\n style="width: 250px; height: 80px; border: 1px solid #c1c1c1;\n margin: 0px; padding: 0px; resize: none;" value="">\n </textarea>\n </div>\n</div>\n</div></noscript></div></form>'
|
||||
# self.assertEqual(form.xml(), rtn)
|
||||
|
||||
# TODO: class TestAuthJWT(unittest.TestCase):
|
||||
|
||||
|
||||
@unittest.skipIf(IS_IMAP, "TODO: Imap raises 'Connection refused'")
|
||||
class TestAuth(unittest.TestCase):
|
||||
class testAuth(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
def testRun(self):
|
||||
# setup
|
||||
request = Request(env={})
|
||||
request.application = 'a'
|
||||
request.controller = 'c'
|
||||
@@ -246,231 +47,37 @@ class TestAuth(unittest.TestCase):
|
||||
current.response = response
|
||||
current.session = session
|
||||
current.T = T
|
||||
self.db = DAL(DEFAULT_URI, check_reserved=['all'])
|
||||
self.auth = Auth(self.db)
|
||||
self.auth.define_tables(username=True, signature=False)
|
||||
self.db.define_table('t0', Field('tt'), self.auth.signature)
|
||||
self.auth.enable_record_versioning(self.db)
|
||||
# Create a user
|
||||
self.auth.get_or_create_user(dict(first_name='Bart',
|
||||
last_name='Simpson',
|
||||
username='bart',
|
||||
email='bart@simpson.com',
|
||||
password='bart_password',
|
||||
registration_key='bart',
|
||||
registration_id=''
|
||||
))
|
||||
# self.auth.settings.registration_requires_verification = False
|
||||
# self.auth.settings.registration_requires_approval = False
|
||||
|
||||
def test_assert_setup(self):
|
||||
self.assertEqual(self.db(self.db.auth_user.username == 'bart').select().first()['username'], 'bart')
|
||||
self.assertTrue('auth_user' in self.db)
|
||||
self.assertTrue('auth_group' in self.db)
|
||||
self.assertTrue('auth_membership' in self.db)
|
||||
self.assertTrue('auth_permission' in self.db)
|
||||
self.assertTrue('auth_event' in self.db)
|
||||
|
||||
def test_enable_record_versioning(self):
|
||||
self.assertTrue('t0_archive' in self.db)
|
||||
|
||||
def test_basic_blank_forms(self):
|
||||
for f in ['login', 'retrieve_password',
|
||||
'retrieve_username',
|
||||
# 'register' # register complain about : client_side=self.settings.client_side
|
||||
]:
|
||||
html_form = getattr(self.auth, f)().xml()
|
||||
db = DAL(DEFAULT_URI, check_reserved=['all'])
|
||||
auth = Auth(db)
|
||||
auth.define_tables(username=True, signature=False)
|
||||
self.assertTrue('auth_user' in db)
|
||||
self.assertTrue('auth_group' in db)
|
||||
self.assertTrue('auth_membership' in db)
|
||||
self.assertTrue('auth_permission' in db)
|
||||
self.assertTrue('auth_event' in db)
|
||||
db.define_table('t0', Field('tt'), auth.signature)
|
||||
auth.enable_record_versioning(db)
|
||||
self.assertTrue('t0_archive' in db)
|
||||
for f in ['login', 'register', 'retrieve_password',
|
||||
'retrieve_username']:
|
||||
html_form = getattr(auth, f)().xml()
|
||||
self.assertTrue('name="_formkey"' in html_form)
|
||||
|
||||
# NOTE: Not sure it is the proper way to logout_bare() as there is not methods for that and auth.logout() failed
|
||||
self.auth.logout_bare()
|
||||
# self.assertTrue(self.auth.is_logged_in())
|
||||
|
||||
for f in ['logout', 'verify_email', 'reset_password',
|
||||
'change_password', 'profile', 'groups']:
|
||||
self.assertRaisesRegexp(HTTP, "303*", getattr(self.auth, f))
|
||||
self.assertRaisesRegexp(HTTP, "303*", getattr(auth, f))
|
||||
|
||||
self.assertRaisesRegexp(HTTP, "401*", self.auth.impersonate)
|
||||
self.assertRaisesRegexp(HTTP, "401*", auth.impersonate)
|
||||
|
||||
try:
|
||||
for t in ['t0_archive', 't0', 'auth_cas', 'auth_event',
|
||||
'auth_membership', 'auth_permission', 'auth_group',
|
||||
'auth_user']:
|
||||
self.db[t].drop()
|
||||
db[t].drop()
|
||||
except SyntaxError as e:
|
||||
# GAE doesn't support drop
|
||||
pass
|
||||
return
|
||||
|
||||
def test_get_or_create_user(self):
|
||||
self.db.auth_user.insert(email='user1@test.com', username='user1', password='password_123')
|
||||
self.db.commit()
|
||||
# True case
|
||||
self.assertEqual(self.auth.get_or_create_user({'email': 'user1@test.com',
|
||||
'username': 'user1',
|
||||
'password': 'password_123'
|
||||
})['username'], 'user1')
|
||||
# user2 doesn't exist yet and get created
|
||||
self.assertEqual(self.auth.get_or_create_user({'email': 'user2@test.com',
|
||||
'username': 'user2'})['username'], 'user2')
|
||||
# user3 for corner case
|
||||
self.assertEqual(self.auth.get_or_create_user({'first_name': 'Omer',
|
||||
'last_name': 'Simpson',
|
||||
'email': 'user3@test.com',
|
||||
'registration_id': 'user3',
|
||||
'username': 'user3'})['username'], 'user3')
|
||||
# False case
|
||||
self.assertEqual(self.auth.get_or_create_user({'email': ''}), None)
|
||||
self.db.auth_user.truncate()
|
||||
self.db.commit()
|
||||
|
||||
def test_login_bare(self):
|
||||
# The following test case should succeed but failed as I never received the user record but False
|
||||
self.auth.login_bare(username='bart@simpson.com', password='bart_password')
|
||||
self.assertTrue(self.auth.is_logged_in())
|
||||
# Failing login because bad_password
|
||||
self.assertEqual(self.auth.login_bare(username='bart', password='wrong_password'), False)
|
||||
self.db.auth_user.truncate()
|
||||
|
||||
def test_register_bare(self):
|
||||
# corner case empty register call register_bare without args
|
||||
self.assertRaises(ValueError, self.auth.register_bare)
|
||||
# failing register_bare user already exist
|
||||
self.assertEqual(self.auth.register_bare(username='bart', password='wrong_password'), False)
|
||||
# successful register_bare
|
||||
self.assertEqual(self.auth.register_bare(username='user2',
|
||||
email='user2@test.com',
|
||||
password='password_123')['username'], 'user2')
|
||||
# raise ValueError
|
||||
self.assertRaises(ValueError, self.auth.register_bare,
|
||||
**dict(wrong_field_name='user3', password='password_123'))
|
||||
# raise ValueError wrong email
|
||||
self.assertRaises(ValueError, self.auth.register_bare,
|
||||
**dict(email='user4@', password='password_123'))
|
||||
self.db.auth_user.truncate()
|
||||
self.db.commit()
|
||||
|
||||
def test_bulk_register(self):
|
||||
self.auth.login_bare(username='bart', password='bart_password')
|
||||
self.auth.settings.bulk_register_enabled = True
|
||||
bulk_register_form = self.auth.bulk_register(max_emails=10).xml()
|
||||
self.assertTrue('name="_formkey"' in bulk_register_form)
|
||||
|
||||
def test_change_password(self):
|
||||
self.auth.login_bare(username='bart', password='bart_password')
|
||||
change_password_form = getattr(self.auth, 'change_password')().xml()
|
||||
self.assertTrue('name="_formkey"' in change_password_form)
|
||||
|
||||
def test_profile(self):
|
||||
self.auth.login_bare(username='bart', password='bart_password')
|
||||
profile_form = getattr(self.auth, 'profile')().xml()
|
||||
self.assertTrue('name="_formkey"' in profile_form)
|
||||
|
||||
# def test_impersonate(self):
|
||||
# # Create a user to be impersonated
|
||||
# self.auth.get_or_create_user(dict(first_name='Omer',
|
||||
# last_name='Simpson',
|
||||
# username='omer',
|
||||
# email='omer@test.com',
|
||||
# password='password_omer',
|
||||
# registration_key='',
|
||||
# registration_id=''))
|
||||
# # Create impersonate group, assign bart to impersonate group and add impersonate permission over auth_user
|
||||
# self.auth.add_group('impersonate')
|
||||
# self.auth.add_membership(user_id=1,
|
||||
# group_id=self.db(self.db.auth_user.username == 'bart'
|
||||
# ).select(self.db.auth_user.id).first().id)
|
||||
# self.auth.add_permission(group_id=self.db(self.db.auth_group.role == 'impersonate'
|
||||
# ).select(self.db.auth_group.id).first().id,
|
||||
# name='impersonate',
|
||||
# table_name='auth_user',
|
||||
# record_id=0)
|
||||
# # Bart login
|
||||
# self.auth.login_bare(username='bart', password='bart_password')
|
||||
# self.assertTrue(self.auth.is_logged_in())
|
||||
# # Bart impersonate Omer
|
||||
# omer_id = self.db(self.db.auth_user.username == 'omer').select(self.db.auth_user.id).first().id
|
||||
# impersonate_form = self.auth.impersonate(user_id=omer_id)
|
||||
# self.assertTrue(self.auth.is_impersonating())
|
||||
# self.assertEqual(impersonate_form, 'test')
|
||||
|
||||
# def test_impersonate(self):
|
||||
# request = Request(env={})
|
||||
# request.application = 'a'
|
||||
# request.controller = 'c'
|
||||
# request.function = 'f'
|
||||
# request.folder = 'applications/admin'
|
||||
# response = Response()
|
||||
# session = Session()
|
||||
# T = translator('', 'en')
|
||||
# session.connect(request, response)
|
||||
# from gluon.globals import current
|
||||
# current.request = request
|
||||
# current.response = response
|
||||
# current.session = session
|
||||
# current.T = T
|
||||
# db = DAL(DEFAULT_URI, check_reserved=['all'])
|
||||
# auth = Auth(db)
|
||||
# auth.define_tables(username=True, signature=False)
|
||||
# db.define_table('t0', Field('tt'), auth.signature)
|
||||
# auth.enable_record_versioning(db)
|
||||
# # Create a user
|
||||
# auth.get_or_create_user(dict(first_name='Bart',
|
||||
# last_name='Simpson',
|
||||
# username='bart',
|
||||
# email='bart@simpson.com',
|
||||
# password='bart_password',
|
||||
# registration_key='bart',
|
||||
# registration_id=''
|
||||
# ))
|
||||
# # Create a user to be impersonated
|
||||
# auth.get_or_create_user(dict(first_name='Omer',
|
||||
# last_name='Simpson',
|
||||
# username='omer',
|
||||
# email='omer@test.com',
|
||||
# password='password_omer',
|
||||
# registration_key='',
|
||||
# registration_id=''))
|
||||
# # Create impersonate group, assign bart to impersonate group and add impersonate permission over auth_user
|
||||
# auth.add_group('impersonate')
|
||||
# auth.add_membership(user_id=1,
|
||||
# group_id=db(db.auth_user.username == 'bart'
|
||||
# ).select(db.auth_user.id).first().id)
|
||||
# auth.add_permission(group_id=db(db.auth_group.role == 'impersonate'
|
||||
# ).select(db.auth_group.id).first().id,
|
||||
# name='impersonate',
|
||||
# table_name='auth_user',
|
||||
# record_id=0)
|
||||
# # Bart login
|
||||
# auth.login_bare(username='bart', password='bart_password')
|
||||
# # Bart impersonate Omer
|
||||
# omer_id = db(db.auth_user.username == 'omer').select(db.auth_user.id).first().id
|
||||
# impersonate_form = auth.impersonate(user_id=omer_id)
|
||||
# self.assertTrue(auth.is_impersonating())
|
||||
# self.assertEqual(impersonate_form, 'test')
|
||||
|
||||
|
||||
# TODO: class TestCrud(unittest.TestCase):
|
||||
# It deprecated so far from a priority
|
||||
|
||||
|
||||
# TODO: class TestService(unittest.TestCase):
|
||||
|
||||
|
||||
# TODO: class TestPluginManager(unittest.TestCase):
|
||||
|
||||
|
||||
# TODO: class TestExpose(unittest.TestCase):
|
||||
|
||||
|
||||
# TODO: class TestWiki(unittest.TestCase):
|
||||
|
||||
|
||||
# TODO: class TestConfig(unittest.TestCase):
|
||||
|
||||
|
||||
# TODO: class TestToolsFunctions(unittest.TestCase):
|
||||
# For all the tools.py functions
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
+12
-72
@@ -10,8 +10,6 @@ fix_sys_path(__file__)
|
||||
|
||||
from utils import md5_hash
|
||||
from utils import compare
|
||||
from utils import is_valid_ip_address
|
||||
from utils import web2py_uuid
|
||||
|
||||
import hashlib
|
||||
from hashlib import md5, sha1, sha224, sha256, sha384, sha512
|
||||
@@ -21,7 +19,11 @@ from utils import simple_hash, get_digest, secure_dumps, secure_loads
|
||||
class TestUtils(unittest.TestCase):
|
||||
""" Tests the utils.py module """
|
||||
|
||||
# TODO: def test_AES_new(self):
|
||||
def test_md5_hash(self):
|
||||
""" Tests the md5_hash function """
|
||||
|
||||
data = md5_hash("web2py rocks")
|
||||
self.assertEqual(data, '79509f3246a2824dee64635303e99204')
|
||||
|
||||
def test_compare(self):
|
||||
""" Tests the compare funciton """
|
||||
@@ -34,62 +36,35 @@ class TestUtils(unittest.TestCase):
|
||||
compare_result_false = compare(a, b)
|
||||
self.assertFalse(compare_result_false)
|
||||
|
||||
def test_md5_hash(self):
|
||||
""" Tests the md5_hash function """
|
||||
|
||||
data = md5_hash("web2py rocks")
|
||||
self.assertEqual(data, '79509f3246a2824dee64635303e99204')
|
||||
|
||||
def test_simple_hash(self):
|
||||
""" Tests the simple_hash function """
|
||||
|
||||
# no key, no salt, digest_alg=None
|
||||
self.assertRaises(RuntimeError, simple_hash, 'web2py rocks!', key='', salt='', digest_alg=None)
|
||||
|
||||
# no key, no salt, digest_alg = md5
|
||||
data_md5 = simple_hash('web2py rocks!', key='', salt='', digest_alg=md5)
|
||||
self.assertEqual(data_md5, '37d95defba6c8834cb8cae86ee888568')
|
||||
|
||||
# no key, no salt, 'md5'
|
||||
# no key, no salt, md5
|
||||
data_md5 = simple_hash('web2py rocks!', key='', salt='', digest_alg='md5')
|
||||
self.assertEqual(data_md5, '37d95defba6c8834cb8cae86ee888568')
|
||||
|
||||
# no key, no salt, 'sha1'
|
||||
# no key, no salt, sha1
|
||||
data_sha1 = simple_hash('web2py rocks!', key='', salt='', digest_alg='sha1')
|
||||
self.assertEqual(data_sha1, '00489a46753d8db260c71542611cdef80652c4b7')
|
||||
|
||||
# no key, no salt, 'sha224'
|
||||
# no key, no salt, sha224
|
||||
data_sha224 = simple_hash('web2py rocks!', key='', salt='', digest_alg='sha224')
|
||||
self.assertEqual(data_sha224, '84d7054271842c2c17983baa2b1447e0289d101140a8c002d49d60da')
|
||||
|
||||
# no key, no salt, 'sha256'
|
||||
# no key, no salt, sha256
|
||||
data_sha256 = simple_hash('web2py rocks!', key='', salt='', digest_alg='sha256')
|
||||
self.assertEqual(data_sha256, '0849f224d8deb267e4598702aaec1bd749e6caec90832469891012a4be24af08')
|
||||
|
||||
# no key, no salt, 'sha384'
|
||||
# no key, no salt, sha384
|
||||
data_sha384 = simple_hash('web2py rocks!', key='', salt='', digest_alg='sha384')
|
||||
self.assertEqual(data_sha384,
|
||||
'3cffaf39371adbe84eb10f588d2718207d8e965e9172a27a278321b86977351376ae79f92e91d8c58cad86c491282d5f')
|
||||
'3cffaf39371adbe84eb10f588d2718207d8e965e9172a27a278321b86977351376ae79f92e91d8c58cad86c491282d5f')
|
||||
|
||||
# no key, no salt, 'sha512'
|
||||
# no key, no salt, sha512
|
||||
data_sha512 = simple_hash('web2py rocks!', key='', salt='', digest_alg='sha512')
|
||||
self.assertEqual(data_sha512, 'fa3237f594743e1d7b6c800bb134b3255cf4a98ab8b01e2ec23256328c9f8059'
|
||||
'64fdef25a038d6cc3fda1b2fb45d66461eeed5c4669e506ec8bdfee71348db7e')
|
||||
|
||||
# NOTE : get_digest() is covered by simple_hash tests above except raise error...
|
||||
def test_get_digest(self):
|
||||
# Bad algorithm
|
||||
# Option 1, think not working with python 2.6
|
||||
# with self.assertRaises(ValueError) as cm:
|
||||
# get_digest('123')
|
||||
# self.assertEqual(cm.exception[0], 'Invalid digest algorithm: 123')
|
||||
# Option 2
|
||||
self.assertRaises(ValueError, get_digest, '123')
|
||||
|
||||
# TODO: def test_get_callable_argspec(self):
|
||||
|
||||
# TODO: def test_pad(self):
|
||||
|
||||
def test_secure_dumps_and_loads(self):
|
||||
""" Tests secure_dumps and secure_loads"""
|
||||
testobj = {'a': 1, 'b': 2}
|
||||
@@ -121,40 +96,5 @@ class TestUtils(unittest.TestCase):
|
||||
wrong4 = secure_loads('abc', 'a', 'b')
|
||||
self.assertEqual(wrong4, None)
|
||||
|
||||
# TODO: def test_initialize_urandom(self):
|
||||
|
||||
# TODO: def test_fast_urandom16(self):
|
||||
|
||||
def test_web2py_uuid(self):
|
||||
from uuid import UUID
|
||||
self.assertTrue(UUID(web2py_uuid()))
|
||||
|
||||
def test_is_valid_ip_address(self):
|
||||
# IPv4
|
||||
# False
|
||||
# self.assertEqual(is_valid_ip_address('127.0'), False) # Fail with AppVeyor?? should pass
|
||||
self.assertEqual(is_valid_ip_address('unknown'), False)
|
||||
self.assertEqual(is_valid_ip_address(''), False)
|
||||
# True
|
||||
self.assertEqual(is_valid_ip_address('127.0.0.1'), True)
|
||||
self.assertEqual(is_valid_ip_address('localhost'), True)
|
||||
self.assertEqual(is_valid_ip_address('::1'), True)
|
||||
# IPv6
|
||||
# True
|
||||
# Compressed
|
||||
self.assertEqual(is_valid_ip_address('::ffff:7f00:1'), True) # IPv6 127.0.0.1 compressed
|
||||
self.assertEqual(is_valid_ip_address('2001:660::1'), True)
|
||||
# Expanded
|
||||
self.assertEqual(is_valid_ip_address('0:0:0:0:0:ffff:7f00:1'), True) # IPv6 127.0.0.1 expanded
|
||||
self.assertEqual(is_valid_ip_address('2607:fa48:6d50:69f1:21f:3cff:fe9d:9be3'), True) # Any address
|
||||
# False
|
||||
# self.assertEqual(is_valid_ip_address('2607:fa48:6d50:69f1:21f:3cff:fe9d:'), False) # Any address with mistake
|
||||
# The above pass locally but fail with AppVeyor
|
||||
|
||||
# TODO: def test_is_loopback_ip_address(self):
|
||||
|
||||
# TODO: def test_getipaddrinfo(self):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
+531
-767
File diff suppressed because it is too large
Load Diff
+9
-11
@@ -22,21 +22,20 @@ from urllib2 import HTTPError
|
||||
|
||||
webserverprocess = None
|
||||
|
||||
|
||||
def startwebserver():
|
||||
global webserverprocess
|
||||
path = path = os.path.dirname(os.path.abspath(__file__))
|
||||
if not os.path.isfile(os.path.join(path, 'web2py.py')):
|
||||
if not os.path.isfile(os.path.join(path,'web2py.py')):
|
||||
i = 0
|
||||
while i < 10:
|
||||
while i<10:
|
||||
i += 1
|
||||
if os.path.exists(os.path.join(path, 'web2py.py')):
|
||||
if os.path.exists(os.path.join(path,'web2py.py')):
|
||||
break
|
||||
path = os.path.abspath(os.path.join(path, '..'))
|
||||
web2py_exec = os.path.join(path, 'web2py.py')
|
||||
webserverprocess = subprocess.Popen([sys.executable, web2py_exec, '-a', 'testpass'])
|
||||
print 'Sleeping before web2py starts...'
|
||||
for a in range(1, 11):
|
||||
for a in range(1,11):
|
||||
time.sleep(1)
|
||||
print a, '...'
|
||||
try:
|
||||
@@ -47,11 +46,10 @@ def startwebserver():
|
||||
continue
|
||||
print ''
|
||||
|
||||
|
||||
def terminate_process(pid):
|
||||
# Taken from http://stackoverflow.com/questions/1064335/in-python-2-5-how-do-i-kill-a-subprocess
|
||||
#Taken from http://stackoverflow.com/questions/1064335/in-python-2-5-how-do-i-kill-a-subprocess
|
||||
# all this **blah** is because we are stuck with Python 2.5 and \
|
||||
# we cannot use Popen.terminate()
|
||||
#we cannot use Popen.terminate()
|
||||
if sys.platform.startswith('win'):
|
||||
import ctypes
|
||||
PROCESS_TERMINATE = 1
|
||||
@@ -61,11 +59,10 @@ def terminate_process(pid):
|
||||
else:
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
|
||||
|
||||
def stopwebserver():
|
||||
global webserverprocess
|
||||
print 'Killing webserver'
|
||||
if sys.version_info < (2, 6):
|
||||
if sys.version_info < (2,6):
|
||||
terminate_process(webserverprocess.pid)
|
||||
else:
|
||||
webserverprocess.terminate()
|
||||
@@ -111,6 +108,7 @@ class TestWeb(LiveTest):
|
||||
# check registration and login were successful
|
||||
client.get('index')
|
||||
|
||||
# COMMENTED BECAUSE FAILS BUT WHY?
|
||||
self.assertTrue('Welcome Homer' in client.text)
|
||||
|
||||
client = WebClient('http://127.0.0.1:8000/admin/default/')
|
||||
@@ -155,7 +153,7 @@ class TestWeb(LiveTest):
|
||||
try:
|
||||
s.post('examples/soap_examples/call/soap', data=xml_request, method="POST")
|
||||
except HTTPError, e:
|
||||
assert(e.msg == 'INTERNAL SERVER ERROR')
|
||||
assert(e.msg=='INTERNAL SERVER ERROR')
|
||||
# check internal server error returned (issue 153)
|
||||
assert(s.status == 500)
|
||||
assert(s.text == xml_response)
|
||||
|
||||
+16
-43
@@ -23,7 +23,6 @@ import glob
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import fnmatch
|
||||
import traceback
|
||||
import smtplib
|
||||
import urllib
|
||||
@@ -820,12 +819,12 @@ class Recaptcha(DIV):
|
||||
Examples:
|
||||
Use as::
|
||||
|
||||
form = FORM(Recaptcha(public_key='...', private_key='...'))
|
||||
form = FORM(Recaptcha(public_key='...',private_key='...'))
|
||||
|
||||
or::
|
||||
|
||||
form = SQLFORM(...)
|
||||
form.append(Recaptcha(public_key='...', private_key='...'))
|
||||
form.append(Recaptcha(public_key='...',private_key='...'))
|
||||
|
||||
"""
|
||||
|
||||
@@ -984,17 +983,17 @@ class Recaptcha2(DIV):
|
||||
Examples:
|
||||
Use as::
|
||||
|
||||
form = FORM(Recaptcha2(public_key='...', private_key='...'))
|
||||
form = FORM(Recaptcha2(public_key='...',private_key='...'))
|
||||
|
||||
or::
|
||||
|
||||
form = SQLFORM(...)
|
||||
form.append(Recaptcha2(public_key='...', private_key='...'))
|
||||
form.append(Recaptcha2(public_key='...',private_key='...'))
|
||||
|
||||
to protect the login page instead, use::
|
||||
|
||||
from gluon.tools import Recaptcha2
|
||||
auth.settings.captcha = Recaptcha2(request, public_key='...', private_key='...')
|
||||
auth.settings.captcha = Recaptcha2(request, public_key='...',private_key='...')
|
||||
|
||||
"""
|
||||
|
||||
@@ -1718,30 +1717,11 @@ class Auth(object):
|
||||
def here(self):
|
||||
return URL(args=current.request.args, vars=current.request.get_vars)
|
||||
|
||||
def select_host(self, host, host_names=None):
|
||||
"""
|
||||
checks that host is valid, i.e. in the list of glob host_names
|
||||
if the host is missing, then is it selects the first entry from host_names
|
||||
read more here: https://github.com/web2py/web2py/issues/1196
|
||||
"""
|
||||
if host:
|
||||
if host_names:
|
||||
for item in host_names:
|
||||
if fnmatch.fnmatch(host, item):
|
||||
break
|
||||
else:
|
||||
raise HTTP(403, "Invalid Hostname")
|
||||
elif host_names:
|
||||
host = host_names[0]
|
||||
else:
|
||||
host = 'localhost'
|
||||
return host
|
||||
|
||||
def __init__(self, environment=None, db=None, mailer=True,
|
||||
hmac_key=None, controller='default', function='user',
|
||||
cas_provider=None, signature=True, secure=False,
|
||||
csrf_prevention=True, propagate_extension=None,
|
||||
url_index=None, jwt=None, host_names=None):
|
||||
url_index=None, jwt=None, host=None):
|
||||
|
||||
## next two lines for backward compatibility
|
||||
if not db and environment and isinstance(environment, DAL):
|
||||
@@ -1785,7 +1765,7 @@ class Auth(object):
|
||||
|
||||
settings = self.settings = Settings()
|
||||
settings.update(Auth.default_settings)
|
||||
host = self.select_host(request.env.http_host, host_names)
|
||||
host = host or request.env.http_host
|
||||
settings.update(
|
||||
cas_domains=[host],
|
||||
enable_tokens=False,
|
||||
@@ -2576,11 +2556,11 @@ class Auth(object):
|
||||
update_keys[key] = keys[key]
|
||||
user.update_record(**update_keys)
|
||||
elif checks:
|
||||
if 'first_name' not in keys and 'first_name' in table_user.fields:
|
||||
if not 'first_name' in keys and 'first_name' in table_user.fields:
|
||||
guess = keys.get('email', 'anonymous').split('@')[0]
|
||||
keys['first_name'] = keys.get('username', guess)
|
||||
vars = table_user._filter_fields(keys)
|
||||
user_id = table_user.insert(**vars)
|
||||
form = table_user._filter_fields(keys)
|
||||
user_id = table_user.insert(**form)
|
||||
user = table_user[user_id]
|
||||
if self.settings.create_user_groups:
|
||||
group_id = self.add_group(
|
||||
@@ -2591,7 +2571,7 @@ class Auth(object):
|
||||
if login:
|
||||
self.user = user
|
||||
if self.settings.register_onaccept:
|
||||
callback(self.settings.register_onaccept, Storage(vars=user))
|
||||
callback(self.settings.register_onaccept, form)
|
||||
return user
|
||||
|
||||
def basic(self, basic_auth_realm=False):
|
||||
@@ -2699,7 +2679,8 @@ class Auth(object):
|
||||
fields[settings.passfield] = \
|
||||
settings.table_user[settings.passfield].validate(fields[settings.passfield])[0]
|
||||
if not fields.get(settings.userfield):
|
||||
raise ValueError('register_bare: userfield not provided or invalid')
|
||||
raise ValueError('register_bare: ' +
|
||||
'userfield not provided or invalid')
|
||||
user = self.get_or_create_user(fields, login=False, get=False,
|
||||
update_fields=self.settings.update_fields)
|
||||
if not user:
|
||||
@@ -3251,16 +3232,12 @@ class Auth(object):
|
||||
next = cas.logout_url(next)
|
||||
|
||||
current.session.auth = None
|
||||
self.user = None
|
||||
if self.settings.renew_session_onlogout:
|
||||
current.session.renew(clear_session=not self.settings.keep_session_onlogout)
|
||||
current.session.flash = self.messages.logged_out
|
||||
if next is not None:
|
||||
redirect(next)
|
||||
|
||||
def logout_bare(self):
|
||||
self.logout(next=None, onlogout=None, log=None)
|
||||
|
||||
def register(self,
|
||||
next=DEFAULT,
|
||||
onvalidation=DEFAULT,
|
||||
@@ -3320,7 +3297,7 @@ class Auth(object):
|
||||
if self.settings.register_verify_password:
|
||||
if self.settings.register_fields is None:
|
||||
self.settings.register_fields = [f.name for f in table_user if f.writable]
|
||||
k = self.settings.register_fields.index(passfield)
|
||||
k = self.settings.register_fields.index("password")
|
||||
self.settings.register_fields.insert(k+1, "password_two")
|
||||
extra_fields = [
|
||||
Field("password_two", "password",
|
||||
@@ -4128,7 +4105,6 @@ class Auth(object):
|
||||
raise HTTP(401, "Not Authorized")
|
||||
current_id = auth.user.id
|
||||
requested_id = user_id
|
||||
user = None
|
||||
if user_id is DEFAULT:
|
||||
user_id = current.request.post_vars.user_id
|
||||
if user_id and user_id != self.user.id and user_id != '0':
|
||||
@@ -4157,10 +4133,7 @@ class Auth(object):
|
||||
return None
|
||||
if requested_id is DEFAULT and not request.post_vars:
|
||||
return SQLFORM.factory(Field('user_id', 'integer'))
|
||||
elif not user:
|
||||
return None
|
||||
else:
|
||||
return SQLFORM(table_user, user.id, readonly=True)
|
||||
return SQLFORM(table_user, user.id, readonly=True)
|
||||
|
||||
def update_groups(self):
|
||||
if not self.user:
|
||||
@@ -4512,7 +4485,7 @@ class Auth(object):
|
||||
ignore_common_filters=True).select(
|
||||
limitby=(0, 1), orderby_on_limitby=False).first()
|
||||
if record:
|
||||
if hasattr(record, 'is_active') and not record.is_active:
|
||||
if hasattr(record, 'is_active') and not record.is_ctive:
|
||||
record.update_record(is_active=True)
|
||||
id = record.id
|
||||
else:
|
||||
|
||||
+2
-2
@@ -172,7 +172,7 @@ def secure_dumps(data, encryption_key, hash_key=None, compression_level=None):
|
||||
dump = pickle.dumps(data, pickle.HIGHEST_PROTOCOL)
|
||||
if compression_level:
|
||||
dump = zlib.compress(dump, compression_level)
|
||||
key = pad(encryption_key)[:32]
|
||||
key = pad(encryption_key[:32])
|
||||
cipher, IV = AES_new(key)
|
||||
encrypted_data = base64.urlsafe_b64encode(IV + cipher.encrypt(pad(dump)))
|
||||
signature = hmac.new(hash_key, encrypted_data).hexdigest()
|
||||
@@ -188,7 +188,7 @@ def secure_loads(data, encryption_key, hash_key=None, compression_level=None):
|
||||
actual_signature = hmac.new(hash_key, encrypted_data).hexdigest()
|
||||
if not compare(signature, actual_signature):
|
||||
return None
|
||||
key = pad(encryption_key)[:32]
|
||||
key = pad(encryption_key[:32])
|
||||
encrypted_data = base64.urlsafe_b64decode(encrypted_data)
|
||||
IV, encrypted_data = encrypted_data[:16], encrypted_data[16:]
|
||||
cipher, _ = AES_new(key, IV=IV)
|
||||
|
||||
+47
-38
@@ -141,6 +141,7 @@ class Validator(object):
|
||||
|
||||
def __call__(self, value):
|
||||
raise NotImplementedError
|
||||
return (value, None)
|
||||
|
||||
|
||||
class IS_MATCH(Validator):
|
||||
@@ -376,8 +377,8 @@ class IS_JSON(Validator):
|
||||
def __call__(self, value):
|
||||
try:
|
||||
if self.native_json:
|
||||
simplejson.loads(value) # raises error in case of malformed json
|
||||
return (value, None) # the serialized value is not passed
|
||||
simplejson.loads(value) # raises error in case of malformed json
|
||||
return (value, None) # the serialized value is not passed
|
||||
else:
|
||||
return (simplejson.loads(value), None)
|
||||
except JSONErrors:
|
||||
@@ -459,7 +460,7 @@ class IS_IN_SET(Validator):
|
||||
|
||||
def __call__(self, value):
|
||||
if self.multiple:
|
||||
# if below was values = re.compile("[\w\-:]+").findall(str(value))
|
||||
### if below was values = re.compile("[\w\-:]+").findall(str(value))
|
||||
if not value:
|
||||
values = []
|
||||
elif isinstance(value, (tuple, list)):
|
||||
@@ -471,6 +472,8 @@ class IS_IN_SET(Validator):
|
||||
thestrset = [str(x) for x in self.theset]
|
||||
failures = [x for x in values if not str(x) in thestrset]
|
||||
if failures and self.theset:
|
||||
if self.multiple and (value is None or value == ''):
|
||||
return ([], None)
|
||||
return (value, translate(self.error_message))
|
||||
if self.multiple:
|
||||
if isinstance(self.multiple, (tuple, list)) and \
|
||||
@@ -523,8 +526,8 @@ class IS_IN_DB(Validator):
|
||||
field = field._id
|
||||
elif isinstance(field, str):
|
||||
items = field.split('.')
|
||||
if len(items) == 1:
|
||||
field = items[0] + '.id'
|
||||
if len(items)==1: items+=['id']
|
||||
field = self.dbset.db[items[0]][items[1]]
|
||||
|
||||
(ktable, kfield) = str(field).split('.')
|
||||
if not label:
|
||||
@@ -534,16 +537,16 @@ class IS_IN_DB(Validator):
|
||||
label = '%%(%s)s' % str(label).split('.')[-1]
|
||||
fieldnames = regex2.findall(label)
|
||||
if kfield not in fieldnames:
|
||||
fieldnames.append(kfield) # kfield must be last
|
||||
fieldnames.append(kfield) # kfield must be last
|
||||
elif isinstance(label, Field):
|
||||
fieldnames = [label.name, kfield] # kfield must be last
|
||||
fieldnames = [label.name, kfield] # kfield must be last
|
||||
label = '%%(%s)s' % label.name
|
||||
elif callable(label):
|
||||
fieldnames = '*'
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
self.fieldnames = fieldnames # fields requires to build the formatting
|
||||
self.field = field # the lookup field
|
||||
self.fieldnames = fieldnames # fields requires to build the formatting
|
||||
self.label = label
|
||||
self.ktable = ktable
|
||||
self.kfield = kfield
|
||||
@@ -621,16 +624,16 @@ class IS_IN_DB(Validator):
|
||||
if isinstance(value, list):
|
||||
values = value
|
||||
elif self.delimiter:
|
||||
values = value.split(self.delimiter) # because of autocomplete
|
||||
values = value.split(self.delimiter) # because of autocomplete
|
||||
elif value:
|
||||
values = [value]
|
||||
else:
|
||||
values = []
|
||||
|
||||
if field.type in ('id', 'integer'):
|
||||
if self.field.type in ('id','integer'):
|
||||
new_values = []
|
||||
for value in values:
|
||||
if not (isinstance(value, (int, long)) or value.isdigit()):
|
||||
if not (isinstance(value,(int,long)) or value.isdigit()):
|
||||
if self.auto_add:
|
||||
value = str(self.maybe_add(table, self.fieldnames[0], value))
|
||||
else:
|
||||
@@ -657,8 +660,8 @@ class IS_IN_DB(Validator):
|
||||
elif count(values) == len(values):
|
||||
return (values, None)
|
||||
else:
|
||||
if field.type in ('id', 'integer'):
|
||||
if isinstance(value, (int, long)) or value.isdigit():
|
||||
if self.field.type in ('id','integer'):
|
||||
if isinstance(value,(int,long)) or value.isdigit():
|
||||
value = int(value)
|
||||
elif self.auto_add:
|
||||
value = self.maybe_add(table, self.fieldnames[0], value)
|
||||
@@ -818,7 +821,7 @@ class IS_INT_IN_RANGE(Validator):
|
||||
if regex_isint.match(str(value)):
|
||||
v = int(value)
|
||||
if ((self.minimum is None or v >= self.minimum) and
|
||||
(self.maximum is None or v < self.maximum)):
|
||||
(self.maximum is None or v < self.maximum)):
|
||||
return (v, None)
|
||||
return (value, self.error_message)
|
||||
|
||||
@@ -892,7 +895,7 @@ class IS_FLOAT_IN_RANGE(Validator):
|
||||
else:
|
||||
v = float(str(value).replace(self.dot, '.'))
|
||||
if ((self.minimum is None or v >= self.minimum) and
|
||||
(self.maximum is None or v <= self.maximum)):
|
||||
(self.maximum is None or v <= self.maximum)):
|
||||
return (v, None)
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
@@ -978,7 +981,7 @@ class IS_DECIMAL_IN_RANGE(Validator):
|
||||
else:
|
||||
v = decimal.Decimal(str(value).replace(self.dot, '.'))
|
||||
if ((self.minimum is None or v >= self.minimum) and
|
||||
(self.maximum is None or v <= self.maximum)):
|
||||
(self.maximum is None or v <= self.maximum)):
|
||||
return (v, None)
|
||||
except (ValueError, TypeError, decimal.InvalidOperation):
|
||||
pass
|
||||
@@ -1198,12 +1201,7 @@ class IS_EMAIL(Validator):
|
||||
self.error_message = error_message
|
||||
|
||||
def __call__(self, value):
|
||||
try:
|
||||
match = self.regex.match(value)
|
||||
except TypeError:
|
||||
# Value may not be a string where we can look for matches.
|
||||
# Example: we're calling ANY_OF formatter and IS_EMAIL is asked to validate a date.
|
||||
match = None
|
||||
match = self.regex.match(value)
|
||||
if match:
|
||||
domain = value.split('@')[1]
|
||||
if (not self.banned or not self.banned.match(domain)) \
|
||||
@@ -2347,7 +2345,6 @@ class IS_DATE_IN_RANGE(IS_DATE):
|
||||
(datetime.date(2010, 3, 3), 'oops')
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
minimum=None,
|
||||
maximum=None,
|
||||
@@ -2401,7 +2398,6 @@ class IS_DATETIME_IN_RANGE(IS_DATETIME):
|
||||
(datetime.datetime(2010, 3, 3, 0, 0), 'oops')
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
minimum=None,
|
||||
maximum=None,
|
||||
@@ -2515,7 +2511,7 @@ def urlify(s, maxlen=80, keep_underscores=False):
|
||||
if keep_underscores:
|
||||
s = re.sub('\s+', '-', s) # whitespace to hyphens
|
||||
s = re.sub('[^\w\-]', '', s)
|
||||
# strip all but alphanumeric/underscore/hyphen
|
||||
# strip all but alphanumeric/underscore/hyphen
|
||||
else:
|
||||
s = re.sub('[\s_]+', '-', s) # whitespace & underscores to hyphens
|
||||
s = re.sub('[^a-z0-9\-]', '', s) # strip all but alphanumeric/hyphen
|
||||
@@ -2613,7 +2609,7 @@ class ANY_OF(Validator):
|
||||
# Use the formatter of the first subvalidator
|
||||
# that validates the value and has a formatter
|
||||
for validator in self.subs:
|
||||
if hasattr(validator, 'formatter') and validator(value)[1] is None:
|
||||
if hasattr(validator, 'formatter') and validator(value)[1] != None:
|
||||
return validator.formatter(value)
|
||||
|
||||
|
||||
@@ -2646,8 +2642,8 @@ class IS_EMPTY_OR(Validator):
|
||||
if hasattr(other, 'options'):
|
||||
self.options = self._options
|
||||
|
||||
def _options(self, *args, **kwargs):
|
||||
options = self.other.options(*args, **kwargs)
|
||||
def _options(self):
|
||||
options = self.other.options()
|
||||
if (not options or options[0][0] != '') and not self.multiple:
|
||||
options.insert(0, ('', ''))
|
||||
return options
|
||||
@@ -2707,7 +2703,6 @@ class LazyCrypt(object):
|
||||
"""
|
||||
Stores a lazy password hash
|
||||
"""
|
||||
|
||||
def __init__(self, crypt, password):
|
||||
"""
|
||||
crypt is an instance of the CRYPT validator,
|
||||
@@ -2763,8 +2758,8 @@ class LazyCrypt(object):
|
||||
# LazyCrypt objects comparison
|
||||
if isinstance(stored_password, self.__class__):
|
||||
return ((self is stored_password) or
|
||||
((self.crypt.key == stored_password.crypt.key) and
|
||||
(self.password == stored_password.password)))
|
||||
((self.crypt.key == stored_password.crypt.key) and
|
||||
(self.password == stored_password.password)))
|
||||
|
||||
if self.crypt.key:
|
||||
if ':' in self.crypt.key:
|
||||
@@ -3068,6 +3063,21 @@ class IS_STRONG(object):
|
||||
return (value, translate(self.error_message))
|
||||
|
||||
|
||||
class IS_IN_SUBSET(IS_IN_SET):
|
||||
|
||||
REGEX_W = re.compile('\w+')
|
||||
|
||||
def __init__(self, *a, **b):
|
||||
IS_IN_SET.__init__(self, *a, **b)
|
||||
|
||||
def __call__(self, value):
|
||||
values = self.REGEX_W.findall(str(value))
|
||||
failures = [x for x in values if IS_IN_SET.__call__(self, x)[1]]
|
||||
if failures:
|
||||
return (value, translate(self.error_message))
|
||||
return (value, None)
|
||||
|
||||
|
||||
class IS_IMAGE(Validator):
|
||||
"""
|
||||
Checks if file uploaded through file input was saved in one of selected
|
||||
@@ -3407,14 +3417,14 @@ class IS_IPV4(Validator):
|
||||
ok = True
|
||||
if not (self.is_localhost is None or self.is_localhost ==
|
||||
(number == self.localhost)):
|
||||
ok = False
|
||||
ok = False
|
||||
if not (self.is_private is None or self.is_private ==
|
||||
(sum([private_number[0] <= number <= private_number[1]
|
||||
for private_number in self.private]) > 0)):
|
||||
ok = False
|
||||
ok = False
|
||||
if not (self.is_automatic is None or self.is_automatic ==
|
||||
(self.automatic[0] <= number <= self.automatic[1])):
|
||||
ok = False
|
||||
ok = False
|
||||
if ok:
|
||||
return (value, None)
|
||||
return (value, translate(self.error_message))
|
||||
@@ -3698,7 +3708,6 @@ class IS_IPADDRESS(Validator):
|
||||
>>> IS_IPADDRESS(subnets='invalidsubnet')('2001::8ffa:fe22:b3af')
|
||||
('2001::8ffa:fe22:b3af', 'invalid subnet provided')
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
minip='0.0.0.0',
|
||||
@@ -3761,7 +3770,7 @@ class IS_IPADDRESS(Validator):
|
||||
is_private=self.is_private,
|
||||
is_automatic=self.is_automatic,
|
||||
error_message=self.error_message
|
||||
)(value)
|
||||
)(value)
|
||||
elif self.is_ipv6 or isinstance(ip, IPv6Address):
|
||||
retval = IS_IPV6(
|
||||
is_private=self.is_private,
|
||||
@@ -3773,7 +3782,7 @@ class IS_IPADDRESS(Validator):
|
||||
is_teredo=self.is_teredo,
|
||||
subnets=self.subnets,
|
||||
error_message=self.error_message
|
||||
)(value)
|
||||
)(value)
|
||||
else:
|
||||
retval = (value, translate(self.error_message))
|
||||
|
||||
|
||||
+9
-5
@@ -17,7 +17,6 @@ import time
|
||||
import thread
|
||||
import threading
|
||||
import os
|
||||
import copy
|
||||
import socket
|
||||
import signal
|
||||
import math
|
||||
@@ -941,10 +940,7 @@ def console():
|
||||
sys.argv, other_args = sys.argv[:k], sys.argv[k + 1:]
|
||||
(options, args) = parser.parse_args()
|
||||
options.args = [options.run] + other_args
|
||||
|
||||
copy_options = copy.deepcopy(options)
|
||||
copy_options.password = '******'
|
||||
global_settings.cmd_options = copy_options
|
||||
global_settings.cmd_options = options
|
||||
global_settings.cmd_args = args
|
||||
|
||||
if options.gae:
|
||||
@@ -1130,6 +1126,14 @@ def start(cron=True):
|
||||
if hasattr(options, key):
|
||||
setattr(options, key, getattr(options2, key))
|
||||
|
||||
logfile0 = os.path.join('examples', 'logging.example.conf')
|
||||
logfile1 = os.path.join(options.folder, 'logging.conf')
|
||||
if not os.path.exists(logfile1) and os.path.exists(logfile0):
|
||||
import shutil
|
||||
sys.stdout.write("Copying logging.conf.example to logging.conf ... ")
|
||||
shutil.copyfile(logfile0, logfile1)
|
||||
sys.stdout.write("OK\n")
|
||||
|
||||
# ## if -T run doctests (no cron)
|
||||
if hasattr(options, 'test') and options.test:
|
||||
test(options.test, verbose=options.verbose)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import time
|
||||
import sys
|
||||
import urllib2
|
||||
import urllib2
|
||||
|
||||
n = int(sys.argv[1])
|
||||
url = sys.argv[2]
|
||||
headers = {"Accept-Language": "en"}
|
||||
req = urllib2.Request(url, None, headers)
|
||||
|
||||
t0 = time.time()
|
||||
for k in xrange(n):
|
||||
data = urllib2.urlopen(req).read()
|
||||
print (time.time() - t0) / n
|
||||
if n == 1:
|
||||
print data
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import re
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
datafile = open(filename, 'r')
|
||||
try:
|
||||
data = '\n' + datafile.read()
|
||||
finally:
|
||||
datafile.close()
|
||||
SPACE = '\n ' if '-n' in sys.argv[1:] else ' '
|
||||
|
||||
data = re.compile('(?<!\:)//(?P<a>.*)').sub('/* \g<a> */', data)
|
||||
data = re.compile('[ ]+').sub(' ', data)
|
||||
data = re.compile('\s*{\s*').sub(' {' + SPACE, data)
|
||||
data = re.compile('\s*;\s*').sub(';' + SPACE, data)
|
||||
data = re.compile(',\s*').sub(', ', data)
|
||||
data = re.compile('\s*\*/\s*').sub('*/' + SPACE, data)
|
||||
data = re.compile('\s*}\s*').sub(SPACE + '}\n', data)
|
||||
data = re.compile('\n\s*\n').sub('\n', data)
|
||||
data = re.compile(';\s+/\*').sub('; /*', data)
|
||||
data = re.compile('\*/\s+/\*').sub(' ', data)
|
||||
data = re.compile('[ ]+\n').sub('\n', data)
|
||||
data = re.compile('\n\s*/[\*]+(?P<a>.*?)[\*]+/', re.DOTALL).sub(
|
||||
'\n/*\g<a>*/\n', data)
|
||||
data = re.compile('[ \t]+(?P<a>\S.+?){').sub(' \g<a>{', data)
|
||||
data = data.replace('}', '}\n')
|
||||
|
||||
print data
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
import sys
|
||||
import re
|
||||
|
||||
|
||||
def cleancss(text):
|
||||
text = re.compile('\s+').sub(' ', text)
|
||||
text = re.compile('\s*(?P<a>,|:)\s*').sub('\g<a> ', text)
|
||||
text = re.compile('\s*;\s*').sub(';\n ', text)
|
||||
text = re.compile('\s*\{\s*').sub(' {\n ', text)
|
||||
text = re.compile('\s*\}\s*').sub('\n}\n\n', text)
|
||||
return text
|
||||
|
||||
|
||||
def cleanhtml(text):
|
||||
text = text.lower()
|
||||
r = re.compile('\<script.+?/script\>', re.DOTALL)
|
||||
scripts = r.findall(text)
|
||||
text = r.sub('<script />', text)
|
||||
r = re.compile('\<style.+?/style\>', re.DOTALL)
|
||||
styles = r.findall(text)
|
||||
text = r.sub('<style />', text)
|
||||
text = re.compile(
|
||||
'<(?P<tag>(input|meta|link|hr|br|img|param))(?P<any>[^\>]*)\s*(?<!/)>')\
|
||||
.sub('<\g<tag>\g<any> />', text)
|
||||
text = text.replace('\n', ' ')
|
||||
text = text.replace('>', '>\n')
|
||||
text = text.replace('<', '\n<')
|
||||
text = re.compile('\s*\n\s*').sub('\n', text)
|
||||
lines = text.split('\n')
|
||||
(indent, newlines) = (0, [])
|
||||
for line in lines:
|
||||
if line[:2] == '</': indent = indent - 1
|
||||
newlines.append(indent * ' ' + line)
|
||||
if not line[:2] == '</' and line[-1:] == '>' and \
|
||||
not line[-2:] in ['/>', '->']: indent = indent + 1
|
||||
text = '\n'.join(newlines)
|
||||
text = re.compile(
|
||||
'\<div(?P<a>( .+)?)\>\s+\</div\>').sub('<div\g<a>></div>', text)
|
||||
text = re.compile('\<a(?P<a>( .+)?)\>\s+(?P<b>[\w\s\(\)\/]+?)\s+\</a\>').sub('<a\g<a>>\g<b></a>', text)
|
||||
text = re.compile('\<b(?P<a>( .+)?)\>\s+(?P<b>[\w\s\(\)\/]+?)\s+\</b\>').sub('<b\g<a>>\g<b></b>', text)
|
||||
text = re.compile('\<i(?P<a>( .+)?)\>\s+(?P<b>[\w\s\(\)\/]+?)\s+\</i\>').sub('<i\g<a>>\g<b></i>', text)
|
||||
text = re.compile('\<span(?P<a>( .+)?)\>\s+(?P<b>[\w\s\(\)\/]+?)\s+\</span\>').sub('<span\g<a>>\g<b></span>', text)
|
||||
text = re.compile('\s+\<br(?P<a>.*?)\/\>').sub('<br\g<a>/>', text)
|
||||
text = re.compile('\>(?P<a>\s+)(?P<b>[\.\,\:\;])').sub('>\g<b>\g<a>', text)
|
||||
text = re.compile('\n\s*\n').sub('\n', text)
|
||||
for script in scripts:
|
||||
text = text.replace('<script />', script, 1)
|
||||
for style in styles:
|
||||
text = text.replace('<style />', cleancss(style), 1)
|
||||
return text
|
||||
|
||||
|
||||
def read_file(filename):
|
||||
f = open(filename, 'r')
|
||||
try:
|
||||
return f.read()
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
for file in sys.argv[1:]:
|
||||
data = read_file(file)
|
||||
open(file+'.bak2', 'w').write(data)
|
||||
if file[-4:] == '.css':
|
||||
data = cleancss(data)
|
||||
if file[-5:] == '.html':
|
||||
data = cleanhtml(data)
|
||||
open(file, 'w').write(data)
|
||||
@@ -0,0 +1,17 @@
|
||||
import re
|
||||
|
||||
|
||||
def cleanjs(text):
|
||||
text = re.sub('\s*}\s*', '\n}\n', text)
|
||||
text = re.sub('\s*{\s*', ' {\n', text)
|
||||
text = re.sub('\s*;\s*', ';\n', text)
|
||||
text = re.sub('\s*,\s*', ', ', text)
|
||||
text = re.sub('\s*(?P<a>[\+\-\*/\=]+)\s*', ' \g<a> ', text)
|
||||
lines = text.split('\n')
|
||||
text = ''
|
||||
indent = 0
|
||||
for line in lines:
|
||||
rline = line.strip()
|
||||
if rline:
|
||||
pass
|
||||
return text
|
||||
@@ -1,6 +1,3 @@
|
||||
"""
|
||||
converts a static file to a web2py view. needs work
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
@@ -100,4 +97,6 @@ def convert(source, destination,prefix='imported'):
|
||||
os.makedirs(os.path.split(fullname)[0])
|
||||
open(fullname,'w').write(views[name])
|
||||
|
||||
|
||||
|
||||
convert(sys.argv[1],sys.argv[2])
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
This script will update untranslated messages in target from source (target and source are both language files)
|
||||
Usage:
|
||||
this can be used as first step when creating language file for new but very similar language
|
||||
or if you want update your app from welcome app of newer web2py version
|
||||
or in non-standard scenarios when you work on target and from any reason you have partial translation in source
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.join(*__file__.split(os.sep)[:-2] or ['.']))
|
||||
|
||||
from gluon.languages import update_from_langfile
|
||||
import argparse
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Use to set untranslated messages in the translation file from another one.')
|
||||
parser.add_argument(
|
||||
'-t', '--target',
|
||||
required=True,
|
||||
dest="target",
|
||||
help="Specify language file (rw) where untranslated messages will be updated if possible"
|
||||
)
|
||||
parser.add_argument(
|
||||
'-s', '--source',
|
||||
required=True,
|
||||
dest="source",
|
||||
help="Specify language file (ro) where seek for translations"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
update_from_langfile(args.target, args.source)
|
||||
|
||||
print '%s was updated.' % args.target
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
import glob
|
||||
import os
|
||||
import zipfile
|
||||
import sys
|
||||
import re
|
||||
from BeautifulSoup import BeautifulSoup as BS
|
||||
|
||||
|
||||
def head(styles):
|
||||
title = '<title>{{=response.title or request.application}}</title>'
|
||||
items = '\n'.join(["{{response.files.append(URL(request.application,'static','%s'))}}" % (style) for style in styles])
|
||||
loc = """<style>
|
||||
div.flash {
|
||||
position: absolute;
|
||||
float: right;
|
||||
padding: 10px;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
opacity: 0.75;
|
||||
margin: 10px 10px 10px 10px;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
color: #fff;
|
||||
font-size: 11pt;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background: black;
|
||||
border: 2px solid #fff;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
z-index: 2;
|
||||
}
|
||||
div.error {
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
background-color: red;
|
||||
color: white;
|
||||
padding: 3px;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
</style>"""
|
||||
return "\n%s\n%s\n{{include 'web2py_ajax.html'}}\n%s" % (title, items, loc)
|
||||
|
||||
|
||||
def content():
|
||||
return """<div class="flash">{{=response.flash or ''}}</div>{{include}}"""
|
||||
|
||||
|
||||
def process(folder):
|
||||
indexfile = open(os.path.join(folder, 'index.html'), 'rb')
|
||||
try:
|
||||
soup = BS(indexfile.read())
|
||||
finally:
|
||||
indexfile.close()
|
||||
styles = [x['href'] for x in soup.findAll('link')]
|
||||
soup.find('head').contents = BS(head(styles))
|
||||
try:
|
||||
soup.find(
|
||||
'h1').contents = BS('{{=response.title or request.application}}')
|
||||
soup.find('h2').contents = BS(
|
||||
"{{=response.subtitle or '=response.subtitle'}}")
|
||||
except:
|
||||
pass
|
||||
for match in (soup.find('div', id='menu'),
|
||||
soup.find('div', {'class': 'menu'}),
|
||||
soup.find('div', id='nav'),
|
||||
soup.find('div', {'class': 'nav'})):
|
||||
if match:
|
||||
match.contents = BS('{{=MENU(response.menu)}}')
|
||||
break
|
||||
done = False
|
||||
for match in (soup.find('div', id='content'),
|
||||
soup.find('div', {'class': 'content'}),
|
||||
soup.find('div', id='main'),
|
||||
soup.find('div', {'class': 'main'})):
|
||||
if match:
|
||||
match.contents = BS(content())
|
||||
done = True
|
||||
break
|
||||
if done:
|
||||
page = soup.prettify()
|
||||
page = re.compile("\s*\{\{=response\.flash or ''\}\}\s*", re.MULTILINE)\
|
||||
.sub("{{=response.flash or ''}}", page)
|
||||
print page
|
||||
else:
|
||||
raise Exception("Unable to convert")
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
print """USAGE:
|
||||
1) start a new web2py application
|
||||
2) Download a sample free layout from the web into the static/ folder of
|
||||
your web2py application (make sure a sample index.html is there)
|
||||
3) run this script with
|
||||
|
||||
python layout_make.py /path/to/web2py/applications/app/static/
|
||||
> /path/to/web2py/applications/app/views/layout.html
|
||||
"""
|
||||
elif not os.path.exists(sys.argv[1]):
|
||||
print 'Folder %s does not exist' % sys.argv[1]
|
||||
else:
|
||||
process(sys.argv[1])
|
||||
@@ -0,0 +1,116 @@
|
||||
import os
|
||||
import glob
|
||||
import zipfile
|
||||
import urllib
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
def copytree(src, dst):
|
||||
names = os.listdir(src)
|
||||
ignored_names = set()
|
||||
errors = []
|
||||
if not os.path.exists(dst):
|
||||
os.makedirs(dst)
|
||||
for name in names:
|
||||
srcname = os.path.join(src, name)
|
||||
dstname = os.path.join(dst, name)
|
||||
if os.path.isdir(srcname):
|
||||
copytree(srcname, dstname)
|
||||
else:
|
||||
shutil.copy2(srcname, dstname)
|
||||
|
||||
class W2PInstance(object):
|
||||
|
||||
SOURCES = {'stable':'http://web2py.com/examples/static/web2py_src.zip',
|
||||
'nightly':'http://web2py.com/examples/static/nightly/web2py_src.zip',
|
||||
'trunk':'https://github.com/web2py/web2py/archive/master.zip'}
|
||||
|
||||
def __init__(self,path):
|
||||
self.path = path
|
||||
|
||||
def warn(self,message="system going down soon"):
|
||||
apps = glob.glob(os.path.join(self.path,'applications','*'))
|
||||
for app in apps:
|
||||
if os.path.isdir(app):
|
||||
open(os.path.join(app,'notifications.txt'),'w').write(message)
|
||||
|
||||
def install(self,source='stable'):
|
||||
if not os.path.exists(self.path):
|
||||
os.mkdir(self.path)
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
link = self.SOURCES[source]
|
||||
srcfile = os.path.join(tmpdir,'web2py_src.zip')
|
||||
print 'downloading...'
|
||||
open(srcfile,'wb').write(urllib.urlopen(link).read())
|
||||
print 'extracing...'
|
||||
zipfile.ZipFile(srcfile,'r').extractall(tmpdir)
|
||||
print 'copying...'
|
||||
copytree(os.path.join(tmpdir,'web2py'),self.path)
|
||||
|
||||
def upgrade(self,source='stable'):
|
||||
self.install(source)
|
||||
|
||||
def upgrade_tmp(self,source,common=False):
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
link = self.SOURCES[source]
|
||||
srcfile = os.path.join(tmpdir,'web2py_src.zip')
|
||||
print 'copying production...'
|
||||
copytree(self.path,os.path.join(tmpdir,'web2py'))
|
||||
tmpdir_web2py = os.path.join(tmpdir,'web2py')
|
||||
tmp_web2py = W2PInstance(tempdir_web2py)
|
||||
tmp_web2py.clear_sessions()
|
||||
tmp_web2py.clear_cache()
|
||||
tmp_web2py.clear_error()
|
||||
print 'downloading...'
|
||||
open(srcfile,'wb').write(urllib.urlopen(link).read())
|
||||
print 'extracing...'
|
||||
zipfile.ZipFile(srcfile,'r').extractall(tmpdir)
|
||||
print 'running tests...'
|
||||
try:
|
||||
olddir = os.getcwd()
|
||||
os.chdir(tempdir_web2py)
|
||||
ret = os.system("PYTHONPATH=. python -m unittest -v gluon.tests")
|
||||
# eventually start web2py and run functional tests
|
||||
finally:
|
||||
os.chrid(olddir)
|
||||
if ret:
|
||||
sys.exit(ret and 1)
|
||||
copytree(os.path.join(tmpdir,'web2py'),self.path)
|
||||
|
||||
def clear_sessions(self):
|
||||
files = glob.glob(os.path.join(self.path,'applications','*','sessions','*'))
|
||||
for file in files:
|
||||
try:
|
||||
os.unlink(file)
|
||||
except:
|
||||
pass
|
||||
|
||||
def clear_cache(self):
|
||||
files = glob.glob(os.path.join(self.path,'applications','*','cache','*'))
|
||||
for file in files:
|
||||
try:
|
||||
os.unlink(file)
|
||||
except:
|
||||
pass
|
||||
|
||||
def clear_errors(self):
|
||||
files = glob.glob(os.path.join(self.path,'applications','*','errors','*'))
|
||||
for file in files:
|
||||
try:
|
||||
os.unlink(file)
|
||||
except:
|
||||
pass
|
||||
|
||||
web2py = W2PInstance('/Users/massimodipierro/Downloads/web2py')
|
||||
#web2py.install()
|
||||
web2py.clear_sessions()
|
||||
|
||||
"""
|
||||
{{
|
||||
import os
|
||||
_notifications = os.path.join(request.folder,'notifications.txt')
|
||||
if os.path.exixts(_notifications):
|
||||
response.flash = response.flash or open(_notifications).read()
|
||||
pass
|
||||
}}
|
||||
"""
|
||||
@@ -0,0 +1,220 @@
|
||||
from service import ServiceBase
|
||||
import os, sys, time, subprocess, atexit
|
||||
from signal import SIGTERM
|
||||
|
||||
class LinuxService(ServiceBase):
|
||||
def __init__(self, name, label, stdout='/dev/null', stderr='/dev/null'):
|
||||
ServiceBase.__init__(self, name, label, stdout, stderr)
|
||||
self.pidfile = '/tmp/%s.pid' % name
|
||||
self.config_file = '/etc/%s.conf' % name
|
||||
|
||||
def daemonize(self):
|
||||
"""
|
||||
do the UNIX double-fork magic, see Stevens' "Advanced
|
||||
Programming in the UNIX Environment" for details (ISBN 0201563177)
|
||||
http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
|
||||
"""
|
||||
try:
|
||||
pid = os.fork()
|
||||
if pid > 0:
|
||||
# exit first parent
|
||||
sys.exit(0)
|
||||
except OSError, e:
|
||||
sys.stderr.write("fork #1 failed: %d (%s)\n" % (e.errno, e.strerror))
|
||||
return
|
||||
|
||||
# decouple from parent environment
|
||||
os.chdir("/")
|
||||
os.setsid()
|
||||
os.umask(0)
|
||||
|
||||
# do second fork
|
||||
try:
|
||||
pid = os.fork()
|
||||
if pid > 0:
|
||||
# exit from second parent
|
||||
sys.exit(0)
|
||||
except OSError, e:
|
||||
sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror))
|
||||
return
|
||||
|
||||
# redirect standard file descriptors
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
si = file('/dev/null', 'r')
|
||||
so = file(self.stdout or '/dev/null', 'a+')
|
||||
se = file(self.stderr or '/dev/null', 'a+')
|
||||
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||
os.dup2(se.fileno(), sys.stderr.fileno())
|
||||
|
||||
def getpid(self):
|
||||
# Check for a pidfile to see if the daemon already runs
|
||||
try:
|
||||
pf = file(self.pidfile,'r')
|
||||
pid = int(pf.read().strip())
|
||||
pf.close()
|
||||
except IOError:
|
||||
pid = None
|
||||
|
||||
return pid
|
||||
|
||||
def status(self):
|
||||
pid = self.getpid()
|
||||
if pid:
|
||||
return 'Service running with PID %s.' % pid
|
||||
else:
|
||||
return 'Service is not running.'
|
||||
|
||||
def check_permissions(self):
|
||||
if not os.geteuid() == 0:
|
||||
return (False, 'This script must be run with root permissions.')
|
||||
else:
|
||||
return (True, '')
|
||||
|
||||
def start(self):
|
||||
"""
|
||||
Start the daemon
|
||||
"""
|
||||
pid = self.getpid()
|
||||
|
||||
if pid:
|
||||
message = "Service already running under PID %s\n"
|
||||
sys.stderr.write(message % self.pidfile)
|
||||
return
|
||||
|
||||
# Start the daemon
|
||||
self.daemonize()
|
||||
self.run()
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
Stop the daemon
|
||||
"""
|
||||
pid = self.getpid()
|
||||
|
||||
if not pid:
|
||||
message = "Service is not running\n"
|
||||
sys.stderr.write(message)
|
||||
return # not an error in a restart
|
||||
|
||||
# Try killing the daemon process
|
||||
try:
|
||||
while 1:
|
||||
os.kill(pid, SIGTERM)
|
||||
time.sleep(0.5)
|
||||
except OSError, err:
|
||||
err = str(err)
|
||||
if err.find("No such process") > 0:
|
||||
if os.path.exists(self.pidfile):
|
||||
os.remove(self.pidfile)
|
||||
else:
|
||||
print str(err)
|
||||
return
|
||||
|
||||
def restart(self):
|
||||
"""
|
||||
Restart the daemon
|
||||
"""
|
||||
self.stop()
|
||||
self.start()
|
||||
|
||||
def run(self):
|
||||
atexit.register(self.terminate)
|
||||
|
||||
args = self.load_configuration()[0]
|
||||
stdout = open(self.stdout, 'a+')
|
||||
stderr = open(self.stderr, 'a+')
|
||||
process = subprocess.Popen(args, stdout=stdout, stderr=stderr)
|
||||
file(self.pidfile,'w+').write("%s\n" % process.pid)
|
||||
process.wait()
|
||||
|
||||
self.terminate()
|
||||
|
||||
def terminate(self):
|
||||
try:
|
||||
os.remove(self.pidfile)
|
||||
except:
|
||||
pass
|
||||
|
||||
def install(self):
|
||||
env = self.detect_environment()
|
||||
src_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'service.py')
|
||||
|
||||
# make sure this script is executable
|
||||
self.run_command('chmod', '+x', src_path)
|
||||
|
||||
# link this daemon to the service directory
|
||||
dest_path = env['rc.d-path'] + self.name
|
||||
os.symlink(src_path, dest_path)
|
||||
|
||||
# start the service at boot
|
||||
install_command = self.get_service_installer_command(env)
|
||||
result = self.run_command(*install_command)
|
||||
self.start()
|
||||
|
||||
def uninstall(self):
|
||||
self.stop()
|
||||
env = self.detect_environment()
|
||||
|
||||
# stop the service from autostarting
|
||||
uninstall_command = self.get_service_uninstaller_command(env)
|
||||
result = self.run_command(*uninstall_command)
|
||||
|
||||
# remove link to the script from the service directory
|
||||
path = env['rc.d-path'] + self.name
|
||||
os.remove(path)
|
||||
|
||||
def detect_environment(self):
|
||||
"""
|
||||
Returns a dictionary of command/path to the required command-line applications.
|
||||
One key is 'dist' which will either be 'debian' or 'redhat', which is the best
|
||||
guess as to which Linux distribution the current system is based on.
|
||||
"""
|
||||
check_for = [
|
||||
'chkconfig',
|
||||
'service',
|
||||
'update-rc.d',
|
||||
'rpm',
|
||||
'dpkg',
|
||||
]
|
||||
|
||||
env = dict()
|
||||
for cmd in check_for:
|
||||
result = self.run_command('which', cmd)
|
||||
if result[0]:
|
||||
env[cmd] = result[0].replace('\n', '')
|
||||
|
||||
if 'rpm' in env:
|
||||
env['dist'] = 'redhat'
|
||||
env['rc.d-path'] = '/etc/rc.d/init.d/'
|
||||
elif 'dpkg' in env:
|
||||
env['dist'] = 'debian'
|
||||
env['rc.d-path'] = '/etc/init.d/'
|
||||
else:
|
||||
env['dist'] = 'unknown'
|
||||
env['rc.d-path'] = '/dev/null/'
|
||||
|
||||
return env
|
||||
|
||||
def get_service_installer_command(self, env):
|
||||
"""
|
||||
Returns list of args required to set a service to run on boot.
|
||||
"""
|
||||
if env['dist'] == 'redhat':
|
||||
cmd = env['chkconfig']
|
||||
return [cmd, self.name, 'on']
|
||||
else:
|
||||
cmd = env['update-rc.d']
|
||||
return [cmd, self.name, 'defaults']
|
||||
|
||||
def get_service_uninstaller_command(self, env):
|
||||
"""
|
||||
Returns list of arge required to stop a service from running at boot.
|
||||
"""
|
||||
if env['dist'] == 'redhat':
|
||||
cmd = env['chkconfig']
|
||||
return [cmd, self.name, 'off']
|
||||
else:
|
||||
cmd = env['update-rc.d']
|
||||
return [cmd, self.name, 'remove']
|
||||
@@ -0,0 +1,201 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys, os, time, subprocess
|
||||
|
||||
class Base:
|
||||
def run_command(self, *args):
|
||||
"""
|
||||
Returns the output of a command as a tuple (output, error).
|
||||
"""
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
return p.communicate()
|
||||
|
||||
class ServiceBase(Base):
|
||||
def __init__(self, name, label, stdout=None, stderr=None):
|
||||
self.name = name
|
||||
self.label = label
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
self.config_file = None
|
||||
|
||||
def load_configuration(self):
|
||||
"""
|
||||
Loads the configuration required to build the command-line string
|
||||
for running web2py. Returns a tuple (command_args, config_dict).
|
||||
"""
|
||||
s = os.path.sep
|
||||
|
||||
default = dict(
|
||||
python = 'python',
|
||||
web2py = os.path.join(s.join(__file__.split(s)[:-3]), 'web2py.py'),
|
||||
http_enabled = True,
|
||||
http_ip = '0.0.0.0',
|
||||
http_port = 8000,
|
||||
https_enabled = True,
|
||||
https_ip = '0.0.0.0',
|
||||
https_port = 8001,
|
||||
https_key = '',
|
||||
https_cert = '',
|
||||
password = '<recycle>',
|
||||
)
|
||||
|
||||
config = default
|
||||
if self.config_file:
|
||||
try:
|
||||
f = open(self.config_file, 'r')
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
|
||||
for line in lines:
|
||||
fields = line.split('=', 1)
|
||||
if len(fields) == 2:
|
||||
key, value = fields
|
||||
key = key.strip()
|
||||
value = value.strip()
|
||||
config[key] = value
|
||||
except:
|
||||
pass
|
||||
|
||||
web2py_path = os.path.dirname(config['web2py'])
|
||||
os.chdir(web2py_path)
|
||||
|
||||
args = [config['python'], config['web2py']]
|
||||
interfaces = []
|
||||
ports = []
|
||||
|
||||
if config['http_enabled']:
|
||||
ip = config['http_ip']
|
||||
port = config['http_port']
|
||||
interfaces.append('%s:%s' % (ip, port))
|
||||
ports.append(port)
|
||||
if config['https_enabled']:
|
||||
ip = config['https_ip']
|
||||
port = config['https_port']
|
||||
key = config['https_key']
|
||||
cert = config['https_cert']
|
||||
if key != '' and cert != '':
|
||||
interfaces.append('%s:%s:%s:%s' % (ip, port, key, cert))
|
||||
ports.append(ports)
|
||||
if len(interfaces) == 0:
|
||||
sys.exit('Configuration error. Must have settings for http and/or https')
|
||||
|
||||
password = config['password']
|
||||
if not password == '<recycle>':
|
||||
from gluon import main
|
||||
for port in ports:
|
||||
main.save_password(password, port)
|
||||
|
||||
password = '<recycle>'
|
||||
|
||||
args.append('-a "%s"' % password)
|
||||
|
||||
interfaces = ';'.join(interfaces)
|
||||
args.append('--interfaces=%s' % interfaces)
|
||||
|
||||
if 'log_filename' in config.keys():
|
||||
log_filename = config['log_filename']
|
||||
args.append('--log_filename=%s' % log_filename)
|
||||
|
||||
return (args, config)
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def restart(self):
|
||||
pass
|
||||
|
||||
def status(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
pass
|
||||
|
||||
def install(self):
|
||||
pass
|
||||
|
||||
def uninstall(self):
|
||||
pass
|
||||
|
||||
def check_permissions(self):
|
||||
"""
|
||||
Does the script have permissions to install, uninstall, start, and stop services?
|
||||
Return value must be a tuple (True/False, error_message_if_False).
|
||||
"""
|
||||
return (False, 'Permissions check not implemented')
|
||||
|
||||
class WebServerBase(Base):
|
||||
def install(self):
|
||||
pass
|
||||
|
||||
def uninstall(self):
|
||||
pass
|
||||
|
||||
|
||||
def get_service():
|
||||
service_name = 'web2py'
|
||||
service_label = 'web2py Service'
|
||||
|
||||
if sys.platform == 'linux2':
|
||||
from linux import LinuxService as Service
|
||||
elif sys.platform == 'darwin':
|
||||
# from mac import MacService as Service
|
||||
sys.exit('Mac OS X is not yet supported.\n')
|
||||
elif sys.platform == 'win32':
|
||||
# from windows import WindowsService as Service
|
||||
sys.exit('Windows is not yet supported.\n')
|
||||
else:
|
||||
sys.exit('The following platform is not supported: %s.\n' % sys.platform)
|
||||
|
||||
service = Service(service_name, service_label)
|
||||
return service
|
||||
|
||||
if __name__ == '__main__':
|
||||
service = get_service()
|
||||
is_root, error_message = service.check_permissions()
|
||||
if not is_root:
|
||||
sys.exit(error_message)
|
||||
|
||||
if len(sys.argv) >= 2:
|
||||
command = sys.argv[1]
|
||||
if command == 'start':
|
||||
service.start()
|
||||
elif command == 'stop':
|
||||
service.stop()
|
||||
elif command == 'restart':
|
||||
service.restart()
|
||||
elif command == 'status':
|
||||
print service.status() + '\n'
|
||||
elif command == 'run':
|
||||
service.run()
|
||||
elif command == 'install':
|
||||
service.install()
|
||||
elif command == 'uninstall':
|
||||
service.uninstall()
|
||||
elif command == 'install-apache':
|
||||
# from apache import Apache
|
||||
# server = Apache()
|
||||
# server.install()
|
||||
sys.exit('Configuring Apache is not yet supported.\n')
|
||||
elif command == 'uninstall-apache':
|
||||
# from apache import Apache
|
||||
# server = Apache()
|
||||
# server.uninstall()
|
||||
sys.exit('Configuring Apache is not yet supported.\n')
|
||||
else:
|
||||
sys.exit('Unknown command: %s' % command)
|
||||
else:
|
||||
print 'Usage: %s [command] \n' % sys.argv[0] + \
|
||||
'\tCommands:\n' + \
|
||||
'\t\tstart Starts the service\n' + \
|
||||
'\t\tstop Stop the service\n' + \
|
||||
'\t\trestart Restart the service\n' + \
|
||||
'\t\tstatus Check if the service is running\n' + \
|
||||
'\t\trun Run service is blocking mode\n' + \
|
||||
'\t\t (Press Ctrl + C to exit)\n' + \
|
||||
'\t\tinstall Install the service\n' + \
|
||||
'\t\tuninstall Uninstall the service\n' + \
|
||||
'\t\tinstall-apache Install as an Apache site\n' + \
|
||||
'\t\tuninstall-apache Uninstall from Apache\n'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user