Adapt le code du plugin d'exemple A2 pour l'AUF

This commit is contained in:
Benjamin Dauvergne 2015-02-02 12:44:02 +01:00
parent 20c70aac7f
commit 2821ba4443
16 changed files with 18 additions and 55 deletions

View File

@ -1,2 +1,2 @@
authentic2-plugin-template is entirely under the copyright of Entr'ouvert and
authentic2-auf is entirely under the copyright of Entr'ouvert and
distributed under the license AGPLv3 or later.

View File

@ -1,3 +1,3 @@
include COPYING
recursive-include src/authentic2_plugin_template/templates *.html
recursive-include src/authentic2_plugin_template/static *.js *.css *.png
recursive-include src/authentic2_auf/templates *.html
recursive-include src/authentic2_auf/static *.js *.css *.png

View File

@ -5,7 +5,7 @@ To rename it to your taste:
$ ./adapt.sh
** THIS IS A TEMPLATE PROJECT **
Authentic2 Plugin Template
Authentic2 Auf
==========================
Install

View File

@ -1,38 +0,0 @@
#!/bin/sh
set -x
echo "Give project name (it must match regexp ^[a-z][a-z0-9-]+$ )"
read PROJECT_NAME
if ! echo $PROJECT_NAME | grep -q '^[a-z][a-z0-9-]\+$'; then
echo "Invalid project name:" $PROJECT_NAME
exit 1
fi
UPPER_UNDERSCORED=`echo $PROJECT_NAME | tr a-z A-Z | sed 's/-/_/g'`
LOWER_UNDERSCORED=`echo $PROJECT_NAME | sed 's/-/_/g'`
TITLECASE=`echo $PROJECT_NAME | sed 's/-/ /g;s/.*/\L&/; s/[a-z]*/\u&/g'`
echo Project name: $PROJECT_NAME
echo Uppercase underscored: $UPPER_UNDERSCORED
echo Lowercase underscored: $LOWER_UNDERSCORED
echo Titlecase: $TITLECASE
if [ -d .git ]; then
MV='git mv'
else
MV=mv
fi
sed -i \
-e "s/authentic2_plugin_template/$LOWER_UNDERSCORED/g" \
-e "s/authentic2-plugin-template/$PROJECT_NAME/g" \
-e "s/A2_TEMPLATE_/A2_$UPPER_UNDERSCORED_/g" \
-e "s/Authentic2 Plugin Template/$TITLECASE/g" \
setup.py src/*/*.py README COPYING MANIFEST.in
$MV src/authentic2_plugin_template/static/authentic2_plugin_template \
src/authentic2_plugin_template/static/$LOWER_UNDERSCORED
$MV src/authentic2_plugin_template/templates/authentic2_plugin_template \
src/authentic2_plugin_template/templates/$LOWER_UNDERSCORED
$MV src/authentic2_plugin_template src/$LOWER_UNDERSCORED

View File

@ -36,10 +36,10 @@ README = file(os.path.join(
os.path.dirname(__file__),
'README')).read()
setup(name='authentic2-plugin-template',
setup(name='authentic2-auf',
version=get_version(),
license='AGPLv3',
description='Authentic2 Plugin Template',
description='Authentic2 Auf',
long_description=README,
author="Entr'ouvert",
author_email="info@entrouvert.com",
@ -48,18 +48,19 @@ setup(name='authentic2-plugin-template',
'': 'src',
},
package_data={
'authentic2_plugin_template': [
'templates/authentic2_plugin_template/*.html',
'static/authentic2_plugin_template/js/*.js',
'static/authentic2_plugin_template/css/*.css',
'static/authentic2_plugin_template/img/*.png',
'authentic2_auf': [
'templates/authentic2_auf/*.html',
'static/authentic2_auf/js/*.js',
'static/authentic2_auf/css/*.css',
'static/authentic2_auf/img/*.png',
],
},
install_requires=[
'auf.django.secretquestions',
],
entry_points={
'authentic2.plugin': [
'authentic2-plugin-template= authentic2_plugin_template:Plugin',
'authentic2-auf= authentic2_auf:Plugin',
],
},
)

View File

@ -5,7 +5,7 @@ from admin_tools.dashboard import modules
def get_admin_modules():
'''Show Client model in authentic2 admin'''
model_list = modules.ModelList(_('Authentic2 Plugin Template'),
models=('authentic2_plugin_template.models.*',))
model_list = modules.ModelList(_('Authentic2 Auf'),
models=('authentic2_auf.models.*',))
return (model_list,)

View File

@ -8,7 +8,7 @@ from .views import index
urlpatterns = required(
setting_enabled('ENABLE', settings=app_settings),
patterns('',
url('^authentic2_plugin_template/$', index,
name='authentic2-plugin-template-index'),
url('^authentic2_auf/$', index,
name='authentic2-auf-index'),
)
)

View File

@ -7,4 +7,4 @@ __ALL_ = [ 'sso' ]
@decorators.plugin_enabled
def index(request):
return render(request, 'authentic2_plugin_template/index.html')
return render(request, 'authentic2_auf/index.html')