initial upload
This commit is contained in:
52
aem_gestion/layout.py
Normal file
52
aem_gestion/layout.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# -*- coding: utf8 -*-
|
||||
from pyramid_layout.layout import layout_config
|
||||
from .security import groupfinder
|
||||
from .views.default import (
|
||||
to_euro,
|
||||
to_euroz,
|
||||
to_percent,
|
||||
)
|
||||
|
||||
@layout_config(template='aem_gestion:templates/global_layout.pt')
|
||||
class GlobalLayout(object):
|
||||
page_title = "Mon espace MARIETTON"
|
||||
|
||||
def __init__(self, context, request):
|
||||
self.context = context
|
||||
self.request = request
|
||||
self.home_url = request.application_url
|
||||
|
||||
def date2dmy(self, ddate):
|
||||
if ddate:
|
||||
# si date, convertir en dd-mm-yyyy
|
||||
madate = ddate.strftime('%d-%m-%Y')
|
||||
else:
|
||||
madate = ''
|
||||
return madate
|
||||
|
||||
def to_euro(self, x):
|
||||
return to_euro(x)
|
||||
|
||||
def to_euroz(self, x):
|
||||
return to_euroz(x)
|
||||
|
||||
def to_percent(self, x):
|
||||
return to_percent(x)
|
||||
|
||||
def get_nextPayment(self, dossier):
|
||||
return get_nextPayment(dossier)
|
||||
|
||||
def isAnonymous(self):
|
||||
user = self.request.authenticated_userid
|
||||
return user is None
|
||||
|
||||
def isAdmin(self):
|
||||
logged_in = self.request.authenticated_userid
|
||||
is_admin = False
|
||||
if logged_in is not None:
|
||||
groups = groupfinder(logged_in, self.request)
|
||||
if 'group:administrators' in groups:
|
||||
is_admin = True
|
||||
|
||||
return is_admin
|
||||
|
||||
Reference in New Issue
Block a user