Skip to content

Commit

Permalink
Merge tag '0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed May 9, 2014
2 parents 917ca8d + c44a5fb commit af14b18
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 634 deletions.
7 changes: 7 additions & 0 deletions .bumpversion.cfg
@@ -0,0 +1,7 @@
[bumpversion]
current_version = 0.1.2
tag_name = {new_version}
files = setup.py doc/conf.py pyramid_duh/__init__.py
commit = True
tag = True

2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -24,6 +24,7 @@ pip-log.txt

# Unit test / coverage reports
.coverage
htmlcov
.tox
nosetests.xml

Expand All @@ -36,7 +37,6 @@ nosetests.xml
.pydevproject
pyramid_duh_env
.ropeproject
_version.py
_localhost.db

# docs
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,11 @@
Changelog
=========

0.1.2
-----
* Bug fix: Fix potential timezone issue when converting unix time to datetime
* Using the 'six' library for python 2/3 compatibility

0.1.1
-----
* Bug fix: IStaticResource fails to look up self.request if nested 2-deep
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
@@ -1,4 +1,3 @@
include pyramid_duh_version.py
include CHANGES.rst
include README.rst
recursive-exclude tests *
7 changes: 7 additions & 0 deletions doc/changes.rst
@@ -1,3 +1,10 @@
Changelog
=========

0.1.2
-----
* Bug fix: Fix potential timezone issue when converting unix time to datetime

0.1.1
-----
* Bug fix: IStaticResource fails to look up self.request if nested 2-deep
Expand Down
9 changes: 3 additions & 6 deletions doc/conf.py
Expand Up @@ -13,18 +13,15 @@
for path in addtl_paths:
sys.path.insert(0, os.path.abspath(os.path.join(docs_basepath, path)))

from pyramid_duh_version import git_version_data

extensions = ['sphinx.ext.autodoc', 'numpydoc', 'sphinx.ext.intersphinx',
'sphinx.ext.linkcode', 'sphinx.ext.autosummary']

master_doc = 'index'
project = u'pyramid_duh'
copyright = u'2013, Steven Arcangeli'

version_data = git_version_data()
version = version_data['tag']
release = version_data['version']
release = '0.1.2'
version = '.'.join(release.split('.')[:2])

exclude_patterns = ['_build']
pygments_style = 'sphinx'
Expand All @@ -42,4 +39,4 @@ def linkcode_resolve(domain, info):
if domain != 'py' or not info['module']:
return None
filename = info['module'].replace('.', '/')
return "https://github.com/stevearc/pyramid_duh/blob/%s/%s.py" % (version_data['ref'], filename)
return "https://github.com/stevearc/pyramid_duh/blob/%s/%s.py" % (release, filename)
40 changes: 4 additions & 36 deletions doc/index.rst
Expand Up @@ -4,11 +4,13 @@ Pyramid Duh - Tools you Want
This is just a collection of utilities that I found myself putting into *every
single* pyramid project I made. So now they're all in one place.

Code lives here: https://github.com/stevearc/pyramid_duh

User Guide
----------

.. toctree::
:maxdepth: 1
:maxdepth: 2
:glob:

topics/request_parameters
Expand All @@ -17,33 +19,7 @@ User Guide
topics/subpath
topics/settings

Versions
--------
========= =============== ========
Version Build Coverage
========= =============== ========
master_ |build-master|_ |coverage-master|_
0.1.1_ |build-0.1.1|_ |coverage-0.1.1|_
0.1.0_ |build-0.1.0|_ |coverage-0.1.0|_
========= =============== ========

.. _master: ../latest/
.. |build-master| image:: https://travis-ci.org/stevearc/pyramid_duh.png?branch=master
.. _build-master: https://travis-ci.org/stevearc/pyramid_duh
.. |coverage-master| image:: https://coveralls.io/repos/stevearc/pyramid_duh/badge.png?branch=master
.. _coverage-master: https://coveralls.io/r/stevearc/pyramid_duh?branch=master

.. _0.1.1: ../0.1.1/
.. |build-0.1.1| image:: https://travis-ci.org/stevearc/pyramid_duh.png?branch=0.1.1
.. _build-0.1.1: https://travis-ci.org/stevearc/pyramid_duh
.. |coverage-0.1.1| image:: https://coveralls.io/repos/stevearc/pyramid_duh/badge.png?branch=0.1.1
.. _coverage-0.1.1: https://coveralls.io/r/stevearc/pyramid_duh?branch=0.1.1

.. _0.1.0: ../0.1.0/
.. |build-0.1.0| image:: https://travis-ci.org/stevearc/pyramid_duh.png?branch=0.1.0
.. _build-0.1.0: https://travis-ci.org/stevearc/pyramid_duh
.. |coverage-0.1.0| image:: https://coveralls.io/repos/stevearc/pyramid_duh/badge.png?branch=0.1.0
.. _coverage-0.1.0: https://coveralls.io/r/stevearc/pyramid_duh?branch=0.1.0
changes

API Reference
-------------
Expand All @@ -53,14 +29,6 @@ API Reference

ref/pyramid_duh

Changelog
---------

.. toctree::
:maxdepth: 1
:glob:

changes

Indices and tables
------------------
Expand Down
1 change: 0 additions & 1 deletion git_hooks/pre-commit
@@ -1,3 +1,2 @@
#!/bin/bash -e
git diff-index --check --cached HEAD --
./pyramid_duh_env/bin/python git_hooks/hook.py
5 changes: 1 addition & 4 deletions pyramid_duh/__init__.py
Expand Up @@ -3,10 +3,7 @@
from .route import ISmartLookupResource, IStaticResource, IModelResource
from .view import addslash

try:
from ._version import * # pylint: disable=F0401,W0401
except ImportError: # pragma: no cover
__version__ = 'unknown'
__version__ = '0.1.2'


def includeme(config):
Expand Down
41 changes: 0 additions & 41 deletions pyramid_duh/compat.py

This file was deleted.

17 changes: 9 additions & 8 deletions pyramid_duh/params.py
Expand Up @@ -4,6 +4,7 @@
import functools
import inspect
import json
import six
from pyramid.httpexceptions import HTTPBadRequest, HTTPException
from pyramid.interfaces import IRequest
from pyramid.path import DottedNameResolver
Expand All @@ -12,7 +13,6 @@
from zope.interface.exceptions import DoesNotImplement
from zope.interface.verify import verifyObject
# pylint: enable=F0401,E0611
from .compat import string_type, bytes_types, num_types, is_string, is_num


NO_ARG = object()
Expand Down Expand Up @@ -122,11 +122,11 @@ def _param_from_dict(request, params, name, default=NO_ARG, type=None,
try:
if type is None:
value = arg
elif type is string_type:
if not is_string(arg):
elif type is six.text_type or type is six.string_types:
if not isinstance(arg, six.string_types):
raise HTTPBadRequest("Argument '%s' is the wrong type!" % name)
value = arg
elif type in bytes_types:
elif type is six.binary_type:
value = arg.encode("utf8")
elif type is list or type is dict:
if loads:
Expand All @@ -139,17 +139,18 @@ def _param_from_dict(request, params, name, default=NO_ARG, type=None,
arg = json.loads(arg)
value = set(arg)
elif type is datetime.datetime or type is datetime:
value = datetime.datetime.fromtimestamp(float(arg))
value = datetime.datetime.utcfromtimestamp(float(arg))
elif type is datetime.timedelta:
value = datetime.timedelta(seconds=float(arg))
elif type is datetime.date:
if is_num(arg) or arg.isdigit():
value = datetime.datetime.fromtimestamp(int(arg)).date()
if (isinstance(arg, six.integer_types) or
isinstance(arg, float) or arg.isdigit()):
value = datetime.datetime.utcfromtimestamp(int(arg)).date()
else:
value = datetime.datetime.strptime(arg, '%Y-%m-%d').date()
elif type is bool:
value = asbool(arg)
elif type in num_types:
elif type in six.integer_types or type is float:
value = type(arg)
else:
if loads:
Expand Down
4 changes: 2 additions & 2 deletions pyramid_duh/view.py
Expand Up @@ -4,9 +4,9 @@

import functools
import inspect
import six
from pyramid.httpexceptions import HTTPFound

from .compat import is_string
from .params import is_request


Expand Down Expand Up @@ -105,7 +105,7 @@ def simple(request)
"""

def __init__(self, paths, config):
if is_string(paths):
if isinstance(paths, six.string_types):
paths = (paths,)
self.paths = paths
self.config = config
Expand Down

0 comments on commit af14b18

Please sign in to comment.