Skip to content
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

rename "master" to "main" #378

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build and test

on:
# Only on pushes to master or one of the release branches we build on push
# Only on pushes to main or one of the release branches we build on push
push:
branches:
- master
- main
- "[0-9].[0-9]+-branch"
tags:
# Build pull requests
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Unreleased (2022-11-14)
-----------------------

- rename "master" to "main"

4.9 (2020-11-24)
----------------

Expand Down
2 changes: 1 addition & 1 deletion RELEASING.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Releasing Pyramid Debugtoolbar
==============================

Prepare master for a new release
Prepare "main" for a new release
--------------------------------

- Do platform test via tox:
Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can contribute to this project in several ways.
Flow](https://guides.github.com/introduction/flow/index.html) describes the
workflow process and why it's a good practice. When submitting a pull
request, sign
[CONTRIBUTORS.txt](https://github.com/Pylons/pyramid_debugtoolbar/blob/master/CONTRIBUTORS.txt)
[CONTRIBUTORS.txt](https://github.com/Pylons/pyramid_debugtoolbar/blob/main/CONTRIBUTORS.txt)
if you have not yet done so.
* Join the IRC channel #pyramid on irc.freenode.net.

Expand Down
43 changes: 31 additions & 12 deletions demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,42 @@

try:
import sqlalchemy
except ImportError: # pragma: no cover
except ImportError: # pragma: no cover
sqlalchemy = None

# True if we are running on Python 3.
PY3 = sys.version_info[0] == 3

if PY3: # pragma: no cover
if PY3: # pragma: no cover
binary_type = bytes
else:
binary_type = str


def text_(s, encoding='latin-1', errors='strict'):
""" If ``s`` is an instance of ``binary_type``, return
"""If ``s`` is an instance of ``binary_type``, return
``s.decode(encoding, errors)``, otherwise return ``s``"""
if isinstance(s, binary_type):
return s.decode(encoding, errors)
return s # pragma: no cover
return s # pragma: no cover


logging.basicConfig(level=logging.NOTSET)
log = logging.getLogger(__file__)

here = os.path.dirname(os.path.abspath(__file__))


@view_config(route_name='test_exc')
def exc(request):
raise RuntimeError


@view_config(route_name='test_squashed_exc')
def squashed_exc(request):
raise RuntimeError


@view_config(
route_name='test_squashed_exc',
context=RuntimeError,
Expand All @@ -53,59 +58,71 @@ def squashed_exc_error_view(request):
request.response.status_code = 404
return {}


@view_config(route_name='test_notfound')
def notfound(request):
raise HTTPNotFound()


@view_config(route_name='test_ajax', renderer='ajax.mako')
def test_ajax(request):
return {}


@view_config(route_name='call_ajax', renderer='json')
def call_ajax(request):
return {'ajax':'success'}
return {'ajax': 'success'}


@view_config(context=HTTPNotFound, renderer='notfound.mako')
def notfound_view(request):
request.response.status_code = 404
return {}


@view_config(renderer='index.mako') # found via traversal
def test_page(request):
title = 'Pyramid Debugtoolbar'
log.info(title)
return {
'title': title,
'show_jinja2_link': True,
'show_sqla_link': bool(sqlalchemy)}
'show_sqla_link': bool(sqlalchemy),
}


@view_config(route_name='test_redirect')
def test_redirect(request):
return HTTPFound(location='/')

@view_config(route_name='test_highorder',
renderer='highorder.mako')

@view_config(route_name='test_highorder', renderer='highorder.mako')
def test_highorder(request):
return {}

@view_config(route_name='test_predicates',
renderer='index.mako')

@view_config(route_name='test_predicates', renderer='index.mako')
def test_predicates(request):
return {'title': 'Test route predicates'}

@view_config(route_name='test_chameleon_exc',
renderer=__name__ + ':templates/error.pt')

@view_config(
route_name='test_chameleon_exc', renderer=__name__ + ':templates/error.pt'
)
@view_config(route_name='test_mako_exc', renderer='error.mako')
@view_config(route_name='test_jinja2_exc', renderer='error.jinja2')
def test_template_exc(request):
return {'title': 'Test template exceptions'}


class DummyRootFactory(object):
def __init__(self, request):
self.request = request

def __getitem__(self, name):
return self


def make_app():
# configuration settings
try:
Expand Down Expand Up @@ -153,9 +170,11 @@ def make_app():
config.include('pyramid_debugtoolbar')
return config.make_wsgi_app()


app = make_app()

if __name__ == '__main__':
from wsgiref.simple_server import make_server

httpd = make_server('', 8080, app)
httpd.serve_forever()
49 changes: 26 additions & 23 deletions demo/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,43 @@
except IOError:
README = CHANGES = ''

install_requires=[
install_requires = [
'pyramid>=1.1.1dev',
'pyramid_debugtoolbar',
'pyramid_mako',
'pyramid_jinja2',
'pyramid_chameleon',
'selenium',
'SQLAlchemy',
]
]

setup(name='debugtoolbar_demo',
version='0.0',
description='A demo application for the debug toolbar',
long_description=README + '\n\n' + CHANGES,
classifiers=[
setup(
name='debugtoolbar_demo',
version='0.0',
description='A demo application for the debug toolbar',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Intended Audience :: Developers",
"Programming Language :: Python",
"Framework :: Pylons",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"License :: Repoze Public License",
],
keywords='web wsgi pylons pyramid',
author="Agendaless Consulting and team",
author_email="pylons-devel@googlegroups.com",
url="http://pylonsproject.org",
license="BSD-derived (http://www.repoze.org/LICENSE.txt)",
include_package_data=True,
zip_safe=False,
install_requires = install_requires,
py_modules=['demo', 'sqla'],
package_data = {'debugtoolbar_demo':
['templates/*.mako',
'templates/*.jinja2]',
'templates/*.pt']},
)

],
keywords='web wsgi pylons pyramid',
author="Agendaless Consulting and team",
author_email="pylons-devel@googlegroups.com",
url="http://pylonsproject.org",
license="BSD-derived (http://www.repoze.org/LICENSE.txt)",
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
py_modules=['demo', 'sqla'],
package_data={
'debugtoolbar_demo': [
'templates/*.mako',
'templates/*.jinja2]',
'templates/*.pt',
]
},
)
28 changes: 19 additions & 9 deletions demo/sqla.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,53 @@
meta = MetaData()

users_table = Table(
'users', meta,
'users',
meta,
Column('id', Integer, primary_key=True),
Column('name', String),
)


def initialize_sql(settings):
engine = create_engine('sqlite://',
connect_args={'check_same_thread':False},
poolclass=StaticPool,
echo=True)
engine = create_engine(
'sqlite://',
connect_args={'check_same_thread': False},
poolclass=StaticPool,
echo=True,
)
settings['engine'] = engine

try:
populate_db(engine)
except:
pass


def populate_db(engine):
meta.create_all(bind=engine)

users = ('blaflamme', 'mcdonc', 'mmerickel')
try:
for i, user in enumerate(users):
engine.execute('insert into users (id, name) values (:id, :name)',
id=i, name=user)
engine.execute(
'insert into users (id, name) values (:id, :name)',
id=i,
name=user,
)
except:
pass


@view_config(route_name='test_sqla', renderer='__main__:templates/sqla.mako')
def test_sqla(request):
engine = request.registry.settings['engine']
users = engine.execute('select * from users')
return {
'title':'Test SQLAlchemy logging',
'users':users,
'title': 'Test SQLAlchemy logging',
'users': users,
}


def includeme(config):
settings = config.registry.settings
initialize_sql(settings)
Expand Down