simplifier le global_layout
This commit is contained in:
@@ -10,7 +10,7 @@ zope.sqlalchemy
|
|||||||
waitress
|
waitress
|
||||||
mysqlclient
|
mysqlclient
|
||||||
yfinance
|
yfinance
|
||||||
docutils
|
markdown2
|
||||||
|
|
||||||
[testing]
|
[testing]
|
||||||
WebTest>=1.3.1
|
WebTest>=1.3.1
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from pyramid.authorization import ACLAuthorizationPolicy
|
|||||||
from pyramid.config import Configurator
|
from pyramid.config import Configurator
|
||||||
from pyramid_mailer import mailer_factory_from_settings
|
from pyramid_mailer import mailer_factory_from_settings
|
||||||
from pyramid.session import SignedCookieSessionFactory
|
from pyramid.session import SignedCookieSessionFactory
|
||||||
from .security import groupfinder
|
|
||||||
|
|
||||||
from .security import groupfinder
|
from .security import groupfinder
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from .views.default import (
|
|||||||
to_decimal,
|
to_decimal,
|
||||||
)
|
)
|
||||||
|
|
||||||
@layout_config(template='templates/layouts/global_layout.pt')
|
@layout_config(template='templates/global_layout.pt')
|
||||||
class GlobalLayout(object):
|
class GlobalLayout(object):
|
||||||
# page_title = "Pagode Tinh-Do"
|
# page_title = "Pagode Tinh-Do"
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ from pyramid.security import (
|
|||||||
DENY_ALL,
|
DENY_ALL,
|
||||||
)
|
)
|
||||||
|
|
||||||
# run configure_mappers after defining all of the models to ensure
|
|
||||||
# all relationships can be setup
|
|
||||||
configure_mappers()
|
|
||||||
|
|
||||||
class RootFactory(object):
|
class RootFactory(object):
|
||||||
"""Defines an ACL for groups/permissions mapping"""
|
"""Defines an ACL for groups/permissions mapping"""
|
||||||
__acl__ = [ (Allow, Authenticated, 'view'),
|
__acl__ = [ (Allow, Authenticated, 'view'),
|
||||||
@@ -22,6 +18,10 @@ class RootFactory(object):
|
|||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# run configure_mappers after defining all of the models to ensure
|
||||||
|
# all relationships can be setup
|
||||||
|
configure_mappers()
|
||||||
|
|
||||||
|
|
||||||
def get_engine(settings, prefix='sqlalchemy.'):
|
def get_engine(settings, prefix='sqlalchemy.'):
|
||||||
return engine_from_config(settings, prefix)
|
return engine_from_config(settings, prefix)
|
||||||
@@ -64,14 +64,18 @@ def includeme(config):
|
|||||||
"""
|
"""
|
||||||
Initialize the model for a Pyramid app.
|
Initialize the model for a Pyramid app.
|
||||||
|
|
||||||
Activate this setup using ``config.include('mondumas.models')``.
|
Activate this setup using ``config.include('caotek_mesavoirs.models')``.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
settings = config.get_settings()
|
settings = config.get_settings()
|
||||||
|
settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
|
||||||
|
|
||||||
# use pyramid_tm to hook the transaction lifecycle to the request
|
# use pyramid_tm to hook the transaction lifecycle to the request
|
||||||
config.include('pyramid_tm')
|
config.include('pyramid_tm')
|
||||||
|
|
||||||
|
# use pyramid_retry to retry a request when transient exceptions occur
|
||||||
|
config.include('pyramid_retry')
|
||||||
|
|
||||||
session_factory = get_session_factory(get_engine(settings))
|
session_factory = get_session_factory(get_engine(settings))
|
||||||
config.registry['dbsession_factory'] = session_factory
|
config.registry['dbsession_factory'] = session_factory
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div class="content text-center">
|
<div class="content text-center">
|
||||||
@@ -11,4 +11,4 @@
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
</div><!-- content -->
|
</div><!-- content -->
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
@@ -112,4 +112,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
@@ -128,4 +128,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
@@ -59,4 +59,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
@@ -64,4 +64,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -53,6 +53,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div><!-- content -->
|
</div><!-- content -->
|
||||||
</metal:block>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-success" />
|
<div tal:condition="message" tal:content="message" class="alert alert-success" />
|
||||||
@@ -228,5 +228,5 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div><!-- content -->
|
</div><!-- content -->
|
||||||
</metal:block>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
@@ -31,4 +31,4 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -19,5 +19,5 @@
|
|||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</metal:block>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div class="alert alert-danger" tal:condition="message" tal:content="message" />
|
<div class="alert alert-danger" tal:condition="message" tal:content="message" />
|
||||||
@@ -84,4 +84,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -74,4 +74,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -17,26 +17,6 @@
|
|||||||
<!-- Custom CSS -->
|
<!-- Custom CSS -->
|
||||||
<link href="${request.static_url('caotek_mesavoirs:static/css/style.less')}" type="text/css" rel="stylesheet/less">
|
<link href="${request.static_url('caotek_mesavoirs:static/css/style.less')}" type="text/css" rel="stylesheet/less">
|
||||||
|
|
||||||
<!-- Bootstrap + jQuery JavaScript plugins) -->
|
|
||||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
|
||||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Bootstrap moment plugin -->
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/fr.js"></script>
|
|
||||||
<!-- Bootstrap Datepicker plugin -->
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
|
||||||
<!-- Datatable -->
|
|
||||||
<script src="//cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
|
|
||||||
<script src="//cdn.datatables.net/1.10.18/js/dataTables.bootstrap.min.js"></script>
|
|
||||||
<script src="//cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
|
||||||
<!-- FormValidation plugin -->
|
|
||||||
<script src="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/js/formValidation.min.js')}"></script>
|
|
||||||
<script src="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/js/framework/bootstrap.min.js')}"></script>
|
|
||||||
<script src="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/js/language/fr_FR.js')}" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<!-- Less -->
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.3/less.min.js" type="text/javascript"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -107,7 +87,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<div metal:define-slot="additional_scripts" />
|
<!-- Bootstrap core JavaScript
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<!-- Bootstrap + jQuery JavaScript plugins) -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||||
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Bootstrap moment plugin -->
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/fr.js"></script>
|
||||||
|
<!-- Bootstrap Datepicker plugin -->
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
|
||||||
|
<!-- Datatable -->
|
||||||
|
<script src="//cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="//cdn.datatables.net/1.10.18/js/dataTables.bootstrap.min.js"></script>
|
||||||
|
<script src="//cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||||
|
<!-- FormValidation plugin -->
|
||||||
|
<script src="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/js/formValidation.min.js')}"></script>
|
||||||
|
<script src="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/js/framework/bootstrap.min.js')}"></script>
|
||||||
|
<script src="${request.static_url('caotek_mesavoirs:static/dist/formvalidation/js/language/fr_FR.js')}" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<!-- Less -->
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.3/less.min.js" type="text/javascript"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -37,5 +37,5 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><!-- content -->
|
</div><!-- content -->
|
||||||
</metal:block>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -25,4 +25,4 @@
|
|||||||
|
|
||||||
</div><!-- container -->
|
</div><!-- container -->
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -76,4 +76,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
@@ -67,4 +67,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
@@ -43,4 +43,4 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
|
||||||
@@ -99,4 +99,4 @@ $(document).ready(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<metal:block use-macro="main_template">
|
<div metal:use-macro="load: ../global_layout.pt">
|
||||||
<div metal:fill-slot="content">
|
<div metal:fill-slot="content">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -49,6 +49,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div><!-- content -->
|
</div><!-- content -->
|
||||||
</metal:block>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ from pyramid.httpexceptions import (
|
|||||||
)
|
)
|
||||||
from pyramid_mailer import get_mailer
|
from pyramid_mailer import get_mailer
|
||||||
from pyramid_mailer.message import Message, Attachment
|
from pyramid_mailer.message import Message, Attachment
|
||||||
from docutils.core import publish_parts
|
|
||||||
|
|
||||||
from sqlalchemy.exc import DBAPIError
|
from sqlalchemy.exc import DBAPIError
|
||||||
from ..security import groupfinder
|
from ..security import groupfinder
|
||||||
@@ -125,7 +124,6 @@ def doc_edit(request):
|
|||||||
new_values[param] = request.params[param]
|
new_values[param] = request.params[param]
|
||||||
|
|
||||||
if new_values:
|
if new_values:
|
||||||
import pdb;pdb.set_trace()
|
|
||||||
update_doc(request, doc_id, new_values)
|
update_doc(request, doc_id, new_values)
|
||||||
if doc_id != '0':
|
if doc_id != '0':
|
||||||
return HTTPFound(location=request.route_url('doc_view', doc_id=doc_id))
|
return HTTPFound(location=request.route_url('doc_view', doc_id=doc_id))
|
||||||
@@ -192,10 +190,7 @@ def doc_view(request):
|
|||||||
|
|
||||||
# insèrer le path de static/img
|
# insèrer le path de static/img
|
||||||
texte = doc.texte.replace('static/img/', "%s/static/img/" % request.application_url)
|
texte = doc.texte.replace('static/img/', "%s/static/img/" % request.application_url)
|
||||||
|
|
||||||
# convertir reST en HTML
|
|
||||||
# texte = publish_parts(texte, writer_name='html')['html_body']
|
|
||||||
|
|
||||||
# convertir mardown en HTML
|
# convertir mardown en HTML
|
||||||
from markdown2 import Markdown
|
from markdown2 import Markdown
|
||||||
markdowner = Markdown()
|
markdowner = Markdown()
|
||||||
@@ -229,3 +224,4 @@ monaa.caotek.fr
|
|||||||
mailer.send_immediately(message)
|
mailer.send_immediately(message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ def redefinir_mdp(request):
|
|||||||
@forbidden_view_config(renderer='../templates/members/login.pt')
|
@forbidden_view_config(renderer='../templates/members/login.pt')
|
||||||
def login(request):
|
def login(request):
|
||||||
|
|
||||||
current_route_path = request.current_route_path()
|
|
||||||
login = ''
|
login = ''
|
||||||
login_url = request.route_url('login')
|
login_url = request.route_url('login')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user