-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] - Fix location accessor #16
base: master
Are you sure you want to change the base?
Changes from all commits
5d54ac0
11075ac
670b449
08207ba
02e8dd0
e91045b
cc28a54
d34187a
37f9698
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,42 @@ | ||
.coverage | ||
*.egg-info | ||
*.log | ||
*.mo | ||
*.py? | ||
*.sw? | ||
*.wpr | ||
.* | ||
*.swp | ||
# dirs | ||
bin/ | ||
buildout-cache/ | ||
develop-eggs/ | ||
eggs/ | ||
extras/ | ||
htmlcov/ | ||
include/ | ||
lib/ | ||
local/ | ||
node_modules/ | ||
parts/ | ||
src/* | ||
test.plone_addon/ | ||
var/ | ||
# files | ||
.installed.cfg | ||
.mr.developer.cfg | ||
Gruntfile.js | ||
lib64 | ||
log.html | ||
output.xml | ||
package.json | ||
pip-selfcheck.json | ||
report.html | ||
.vscode/ | ||
.tox/ | ||
reports/ | ||
# excludes | ||
!.coveragerc | ||
!.editorconfig | ||
!.gitattributes | ||
!.gitignore | ||
!.gitkeep | ||
!.travis.yml | ||
dist/ | ||
!src/collective |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
language: python | ||
addons: | ||
chrome: stable | ||
python: | ||
- "2.7" | ||
matrix: | ||
include: | ||
- python: "2.7" | ||
env: PLONE_VERSION=5.1.x | ||
env: PLONE_VERSION=51 | ||
- python: "2.7" | ||
env: PLONE_VERSION=5.2.x | ||
- python: "3.6" | ||
env: PLONE_VERSION=5.2.x | ||
env: PLONE_VERSION=52 | ||
- python: "3.7" | ||
env: PLONE_VERSION=5.2.x | ||
env: PLONE_VERSION=52 | ||
- python: "3.8" | ||
env: PLONE_VERSION=5.2.x | ||
env: PLONE_VERSION=52 | ||
dist: xenial | ||
cache: | ||
pip: true | ||
directories: | ||
- eggs | ||
- downloads | ||
fast_finish: true | ||
before_install: | ||
# install chrome webdriver | ||
- mkdir webdriver; | ||
wget https://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip; | ||
unzip chromedriver_linux64.zip -d webdriver; | ||
export PATH=$PATH:$(pwd)/webdriver; | ||
- virtualenv -p `which python` . | ||
- mkdir -p $HOME/buildout-cache/{eggs,downloads} | ||
- mkdir $HOME/.buildout | ||
- echo "[buildout]" > $HOME/.buildout/default.cfg | ||
- echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg | ||
- echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg | ||
- pip install zc.buildout | ||
- sed -ie "s#5.1.x.cfg#$PLONE_VERSION.cfg#" buildout.cfg | ||
- bin/pip install -r requirements.txt -c constraints_plone$PLONE_VERSION.txt | ||
# - bin/buildout -N out:download-cache=downloads code-analysis:return-status-codes=True annotate | ||
# - bin/buildout -N buildout:download-cache=downloads code-analysis:return-status-codes=True | ||
- cp test_plone$PLONE_VERSION.cfg buildout.cfg | ||
|
||
install: | ||
- buildout -N annotate | ||
- buildout -N | ||
- bin/buildout -N -t 3 code-analysis:return-status-codes=True annotate | ||
- bin/buildout -N -t 3 code-analysis:return-status-codes=True | ||
|
||
before_script: | ||
- 'export DISPLAY=:99.0' | ||
- "export DISPLAY=:99.0" | ||
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | ||
- sleep 3 | ||
- firefox -v | ||
|
||
script: | ||
# Run code-analysis, except on Python 3.6, which mysteriously fails to find zc.buildout. | ||
# Run code-analysis, except on Python 3.6, which mysteriously fails to find zc.buildout. | ||
- python --version 2> /dev/stdout | grep 3.6 || bin/code-analysis | ||
- bin/test | ||
|
||
after_script: | ||
- bin/createcoverage --output-dir=parts/test/coverage | ||
|
||
after_success: | ||
- bin/createcoverage -t "--layer=!Robot" | ||
- pip install --upgrade coveralls | ||
- bin/pip install coverage | ||
- bin/python -m coverage.pickle2json | ||
- bin/pip install -q coveralls | ||
- coveralls | ||
notifications: | ||
irc: irc.freenode.org#plone-testing |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
[buildout] | ||
show-picked-versions = true | ||
extensions = | ||
mr.developer | ||
|
||
index = https://pypi.python.org/simple/ | ||
|
||
parts = | ||
instance | ||
test | ||
code-analysis | ||
coverage | ||
test-coverage | ||
createcoverage | ||
releaser | ||
i18ndude | ||
omelette | ||
robot | ||
plone-helper-scripts | ||
develop = . | ||
|
||
|
||
[instance] | ||
recipe = plone.recipe.zope2instance | ||
user = admin:admin | ||
http-address = 8080 | ||
environment-vars = | ||
zope_i18n_compile_mo_files true | ||
eggs = | ||
Plone | ||
Pillow | ||
collective.venue [test] | ||
|
||
|
||
[code-analysis] | ||
recipe = plone.recipe.codeanalysis[recommended] | ||
directory = ${buildout:directory}/src/collective | ||
return-status-codes = False | ||
|
||
|
||
[omelette] | ||
recipe = collective.recipe.omelette | ||
eggs = ${instance:eggs} | ||
|
||
|
||
[test] | ||
recipe = zc.recipe.testrunner | ||
eggs = ${instance:eggs} | ||
initialization = | ||
os.environ['TZ'] = 'UTC' | ||
defaults = ['-s', 'collective.venue', '--auto-color', '--auto-progress'] | ||
|
||
|
||
[coverage] | ||
recipe = zc.recipe.egg | ||
eggs = coverage | ||
|
||
|
||
[test-coverage] | ||
recipe = collective.recipe.template | ||
input = inline: | ||
#!/bin/bash | ||
export TZ=UTC | ||
${buildout:directory}/bin/coverage run bin/test $* | ||
${buildout:directory}/bin/coverage html | ||
${buildout:directory}/bin/coverage report -m --fail-under=90 | ||
# Fail (exit status 1) if coverage returns exit status 2 (this happens | ||
# when test coverage is below 100%. | ||
output = ${buildout:directory}/bin/test-coverage | ||
mode = 755 | ||
|
||
|
||
[createcoverage] | ||
recipe = zc.recipe.egg | ||
eggs = createcoverage | ||
|
||
|
||
[robot] | ||
recipe = zc.recipe.egg | ||
eggs = | ||
${test:eggs} | ||
plone.app.robotframework[debug,reload] | ||
|
||
|
||
[releaser] | ||
recipe = zc.recipe.egg | ||
eggs = zest.releaser | ||
|
||
|
||
[i18ndude] | ||
recipe = zc.recipe.egg | ||
eggs = i18ndude | ||
|
||
[plone-helper-scripts] | ||
recipe = zc.recipe.egg | ||
eggs = | ||
Products.CMFPlone | ||
${instance:eggs} | ||
interpreter = zopepy | ||
scripts = | ||
zopepy | ||
plone-compile-resources | ||
|
||
[versions] | ||
# Don't use a released version of collective.venue | ||
collective.venue = |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[main] | ||
version = 5.1 | ||
template = plone_addon | ||
git_init = True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,7 @@ | ||
[buildout] | ||
# use this extend one of the buildout configuration: | ||
extends = | ||
https://github.com/raw/collective/buildout.plonetest/master/test-5.1.x.cfg | ||
https://github.com/raw/collective/buildout.plonetest/master/qa.cfg | ||
https://github.com/raw/plone/plone.app.robotframework/master/versions.cfg | ||
|
||
package-name = collective.venue | ||
package-extras = | ||
|
||
parts += | ||
code-analysis | ||
i18ndude | ||
node | ||
omelette | ||
|
||
extensions = mr.developer | ||
eggs += | ||
collective.geolocationbehavior | ||
sources = sources | ||
versions = versions | ||
sources-dir = extras | ||
#auto-checkout = | ||
# plone.formwidget.geolocation | ||
# collective.geolocationbehavior | ||
|
||
[code-analysis] | ||
flake8-ignore = E501 | ||
|
||
[i18ndude] | ||
recipe = zc.recipe.egg | ||
eggs = i18ndude | ||
|
||
[omelette] | ||
recipe = collective.recipe.omelette | ||
eggs = ${test:eggs} | ||
|
||
[versions] | ||
# use latest version of coverage | ||
coverage = | ||
setuptools = | ||
zc.buildout = | ||
|
||
[sources] | ||
plone.formwidget.geolocation = git ${remotes:collective}/plone.formwidget.geolocation.git pushurl=${remotes:collective_push}/plone.formwidget.geolocation.git branch=map-settings | ||
collective.geolocationbehavior = git ${remotes:collective}/collective.geolocationbehavior.git pushurl=${remotes:collective_push}/collective.geolocationbehavior.git branch=petschki-indexer-adapter | ||
|
||
[versions] | ||
plone.formwidget.geolocation = | ||
collective.geolocationbehavior = | ||
collective.venue = | ||
|
||
[remotes] | ||
# Collective | ||
collective = https://github.com/collective | ||
collective_push = git@github.com:collective | ||
# test_plone43.cfg | ||
# test_plone50.cfg | ||
# test_plone51.cfg | ||
test_plone52.cfg |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
from zope import schema | ||
from zope.interface import provider | ||
from zope.schema.interfaces import IContextAwareDefaultFactory | ||
from z3c.relationfield.schema import RelationChoice | ||
|
||
|
||
@provider(IContextAwareDefaultFactory) | ||
|
@@ -25,25 +26,24 @@ def default_location(context): | |
@provider(IFormFieldProvider) | ||
class ILocation(model.Schema, IVenueEnabled, IDXEvent): | ||
|
||
location_uid = schema.Choice( | ||
location_ref = RelationChoice( | ||
title=_(u'label_event_location', default=u'Location'), | ||
description=_( | ||
u'description_event_location', default=u'Select a location.' | ||
), | ||
required=False, | ||
missing_value='', | ||
defaultFactory=default_location, | ||
# defaultFactory=default_location, | ||
vocabulary='plone.app.vocabularies.Catalog', | ||
) | ||
form.widget( | ||
'location_uid', | ||
'location_ref', | ||
RelatedItemsFieldWidget, | ||
vocabulary='plone.app.vocabularies.Catalog', | ||
pattern_options={ | ||
'selectableTypes': ['Venue'], | ||
'basePath': get_base_path, | ||
# 'basePath': get_base_path, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the idea behind the basePath was to allow access to venues outside the current plone site, e.g. if you're in a lineage subsite of another parent site and want to have access to the "address book" of that parent site. but the catalog on the other hand looks much more convenient. you don't have to browse to the venues then, right? |
||
}, | ||
) | ||
|
||
location_notes = schema.Text( | ||
title=_(u'label_event_location_notes', default=u'Location notes'), | ||
description=_( | ||
|
@@ -56,7 +56,7 @@ class ILocation(model.Schema, IVenueEnabled, IDXEvent): | |
directives.fieldset( | ||
'venue', | ||
label=_(u'fieldset_venue'), | ||
fields=['location_uid', 'location_notes'], | ||
fields=['location_ref', 'location_notes'], | ||
) | ||
|
||
|
||
|
@@ -73,18 +73,17 @@ def default_organizer(context): | |
@provider(IFormFieldProvider) | ||
class IOrganizer(model.Schema, IVenueEnabled): | ||
|
||
organizer_uid = schema.Choice( | ||
organizer_ref = RelationChoice( | ||
title=_(u'label_event_organizer', default=u'Organizer'), | ||
description=_( | ||
u'description_event_organizer', default=u'Select an organizer.' | ||
), | ||
required=False, | ||
missing_value='', | ||
defaultFactory=default_organizer, | ||
# defaultFactory=default_organizer, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here like above |
||
vocabulary='plone.app.vocabularies.Catalog', | ||
) | ||
form.widget( | ||
'organizer_uid', | ||
'organizer_ref', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we use the vocabulary in the IVenue for the location_ref, shouldn'd we also use the vocabulary here? |
||
RelatedItemsFieldWidget, | ||
pattern_options={ | ||
'selectableTypes': ['Venue'], | ||
|
@@ -104,6 +103,6 @@ class IOrganizer(model.Schema, IVenueEnabled): | |
directives.fieldset( | ||
'venue', | ||
label=_(u'fieldset_venue'), | ||
fields=['organizer_uid', 'organizer_notes'], | ||
fields=['organizer_ref', 'organizer_notes'], | ||
order=10, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why no default_location? the idea behind this was that some organizers have their events most always in the same location and with the overridable default location it can be pre-set.