pax_global_header00006660000000000000000000000064125037655250014524gustar00rootroot0000000000000052 comment=1d28ae858d555c790c74bc14db4aeaa241698295 Flask-Gravatar-0.4.2/000077500000000000000000000000001250376552500143345ustar00rootroot00000000000000Flask-Gravatar-0.4.2/.coveragerc000066400000000000000000000000361250376552500164540ustar00rootroot00000000000000[run] source = flask_gravatar Flask-Gravatar-0.4.2/.gitignore000066400000000000000000000001421250376552500163210ustar00rootroot00000000000000*.pyc *.pyo .cache .coverage .tox Flask_Gravatar.egg-info/ build/ dist/ docs/_build/ docs/html/ Flask-Gravatar-0.4.2/.travis.yml000066400000000000000000000012611250376552500164450ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. language: python python: - "2.6" - "2.7" - "3.3" - "3.4" install: - pip install --upgrade pip --use-mirrors - pip install coveralls pep257 --use-mirrors - pip install pytest pytest-pep8 pytest-cov pytest-cache --use-mirrors - pip install -e .[docs] script: - pep257 flask_gravatar - "sphinx-build -qnNW docs docs/_build/html" - python setup.py test after_success: - coveralls notifications: email: false Flask-Gravatar-0.4.2/AUTHORS000066400000000000000000000010121250376552500153760ustar00rootroot00000000000000Authors ------- * Alexander Zelenyak * Andrew Grigorev * Donald Stufft * Honza Javorek * Jiri Kuncar * Julien Kauffmann * Klinkin * Li Chuangbo * Max Countryman * Miguel Grinberg * Nauman Ahmad * Paul Bonser * Tom Powell Flask-Gravatar-0.4.2/CHANGES000066400000000000000000000013371250376552500153330ustar00rootroot00000000000000Changes ======= Version 0.4.2 (released 2015-03-23) - Set use_ssl default value according to request protocol. (pull #14) - Improved documentation typo fixes. (pull #13 #18) - Migration from flaskext.gravatar to flask_gravatar. (pull #11 #12) Version 0.4.1 (released 2013-11-07) - Added Python 3 support. (pull #9) Version 0.4.0 (released 2013-08-09) - Added custom url support. (pull #7) - Use setuptools. (pull #6) Version 0.3.0 (released 2013-03-23) - Enabled registering multiple times in one process. Version 0.2.4 (released 2012-11-28) - Added init_app method. - Fixed various bugs. Version 0.2.3 (released 2011-11-29) - Added HTTPS suppport. Version 0.2.2 (released 2011-01-10) - First public release. - It works. Flask-Gravatar-0.4.2/CONTRIBUTING.rst000066400000000000000000000010661250376552500170000ustar00rootroot00000000000000Contributing ============ Bug reports, feature requests, and other contributions are welcome. If you find a demonstrable problem that is caused by the code of this library, please: 1. Search for `already reported problems `_. 2. Check if the issue has been fixed or is still reproducible on the latest `master` branch. 3. Create an issue with **a test case**. If you create a feature branch, you can run the tests to ensure everything is operating correctly: .. code-block:: console $ ./run-tests.sh Flask-Gravatar-0.4.2/LICENSE000066400000000000000000000042751250376552500153510ustar00rootroot00000000000000Flask-Gravatar is free software; you can redistribute it and/or modify it under the terms of the Revised BSD License quoted below. Copyright (C) 2011, 2012, 2013, 2014, 2015 Alexander Zelenyak. Copyright (C) 2011 Max Countryman. Copyright (C) 2012 Honza Javorek. Copyright (C) 2012 Klinkin. Copyright (C) 2013 Donald Stufft. Copyright (C) 2013 Julien Kauffmann. Copyright (C) 2013 Li Chuangbo. Copyright (C) 2013 Miguel Grinberg. Copyright (C) 2014 Andrew Grigorev. Copyright (C) 2014 Nauman Ahmad. Copyright (C) 2014 Paul Bonser. Copyright (C) 2014 Tom Powell. Copyright (C) 2015 CERN. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. Flask-Gravatar-0.4.2/MANIFEST.in000066400000000000000000000011301250376552500160650ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. include LICENSE AUTHORS CHANGES *.rst include .coveragerc run-tests.sh pytest.ini tox.ini include docs/*.rst docs/*.py docs/Makefile recursive-include docs/_themes *.py *.css *.css_t *.conf *.html LICENSE README recursive-include docs/_templates *.html recursive-include tests *.py recursive-exclude docs *.pyc *.pyo .DS_Store prune docs/_build Flask-Gravatar-0.4.2/README.rst000066400000000000000000000031301250376552500160200ustar00rootroot00000000000000================ Flask Gravatar ================ .. image:: https://travis-ci.org/zzzsochi/flask-gravatar.png?branch=master :target: https://travis-ci.org/zzzsochi/flask-gravatar .. image:: https://coveralls.io/repos/zzzsochi/flask-gravatar/badge.png?branch=master :target: https://coveralls.io/r/zzzsochi/flask-gravatar .. image:: https://pypip.in/v/Flask-Gravatar/badge.png :target: https://pypi.python.org/pypi/Flask-Gravatar/ .. image:: https://pypip.in/d/Flask-Gravatar/badge.png :target: https://pypi.python.org/pypi/Flask-Gravatar/ About ===== This is small and simple integration `gravatar`_ into `flask`_. .. _flask: http://flask.pocoo.org .. _gravatar: http://gravatar.com Installation ============ Flask-Gravatar is on PyPI so all you need is: :: pip install Flask-Gravatar Documentation ============= Initialize with flask application and default parameters: :: gravatar = Gravatar(app, size=100, rating='g', default='retro', force_default=False, use_ssl=False, base_url=None) Then in your template: :: {{ 'zzz.sochi@gmail.com' | gravatar }} Bigger and adult: :: {{ 'zzz.sochi@gmail.com' | gravatar(size=200, rating='x') }} Parameters ---------- All parameters are described in `gravatar documentation`_. .. _gravatar documentation: http://gravatar.com/site/implement/images Testing ======= Running the test suite is as simple as: :: python setup.py test or, to also show code coverage: :: ./run-tests.sh Flask-Gravatar-0.4.2/RELEASE-NOTES.rst000066400000000000000000000013171250376552500170360ustar00rootroot00000000000000=================================== Flask-Gravatar v0.4.2 is released =================================== Flask-Gravatar v0.4.2 was released on March 23, 2015. About ----- Small extension for Flask to make usage of Gravatar service easy. What's new ---------- - Set use_ssl default value according to request protocol. (pull #14) - Improved documentation typo fixes. (pull #13 #18) - Migration from flaskext.gravatar to flask_gravatar. (pull #11 #12) Installation ------------ $ pip install Flask-Gravatar Documentation ------------- http://flask-gravatar.readthedocs.org/en/v0.4.2 Homepage -------- https://github.com/zzzsochi/flask-gravatar Happy hacking and thanks for choosing Flask-Gravatar. Flask-Gravatar-0.4.2/docs/000077500000000000000000000000001250376552500152645ustar00rootroot00000000000000Flask-Gravatar-0.4.2/docs/_themes/000077500000000000000000000000001250376552500167105ustar00rootroot00000000000000Flask-Gravatar-0.4.2/docs/_themes/LICENSE000066400000000000000000000033751250376552500177250ustar00rootroot00000000000000Copyright (c) 2010 by Armin Ronacher. Some rights reserved. Redistribution and use in source and binary forms of the theme, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. We kindly ask you to only use these themes in an unmodified manner just for Flask and Flask-related products, not for unrelated projects. If you like the visual style and want to use it for your own projects, please consider making some larger changes to the themes (such as changing font faces, sizes, colors or margins). THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Flask-Gravatar-0.4.2/docs/_themes/README000066400000000000000000000021051250376552500175660ustar00rootroot00000000000000Flask Sphinx Styles =================== This repository contains sphinx styles for Flask and Flask related projects. To use this style in your Sphinx documentation, follow this guide: 1. put this folder as _themes into your docs folder. Alternatively you can also use git submodules to check out the contents there. 2. add this to your conf.py: sys.path.append(os.path.abspath('_themes')) html_theme_path = ['_themes'] html_theme = 'flask' The following themes exist: - 'flask' - the standard flask documentation theme for large projects - 'flask_small' - small one-page theme. Intended to be used by very small addon libraries for flask. The following options exist for the flask_small theme: [options] index_logo = '' filename of a picture in _static to be used as replacement for the h1 in the index.rst file. index_logo_height = 120px height of the index logo github_fork = '' repository name on github for the "fork me" badge Flask-Gravatar-0.4.2/docs/_themes/flask_small/000077500000000000000000000000001250376552500212005ustar00rootroot00000000000000Flask-Gravatar-0.4.2/docs/_themes/flask_small/layout.html000066400000000000000000000012531250376552500234040ustar00rootroot00000000000000{% extends "basic/layout.html" %} {% block header %} {{ super() }} {% if pagename == 'index' %}
{% endif %} {% endblock %} {% block footer %} {% if pagename == 'index' %}
{% endif %} {% endblock %} {# do not display relbars #} {% block relbar1 %}{% endblock %} {% block relbar2 %} {% if theme_github_fork %} Fork me on GitHub {% endif %} {% endblock %} {% block sidebar1 %}{% endblock %} {% block sidebar2 %}{% endblock %} Flask-Gravatar-0.4.2/docs/_themes/flask_small/static/000077500000000000000000000000001250376552500224675ustar00rootroot00000000000000Flask-Gravatar-0.4.2/docs/_themes/flask_small/static/flasky.css_t000066400000000000000000000110011250376552500250060ustar00rootroot00000000000000/* * flasky.css_t * ~~~~~~~~~~~~ * * Sphinx stylesheet -- flasky theme based on nature theme. * * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: 'Georgia', serif; font-size: 17px; color: #000; background: white; margin: 0; padding: 0; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 40px auto 0 auto; width: 700px; } hr { border: 1px solid #B1B4B6; } div.body { background-color: #ffffff; color: #3E4349; padding: 0 30px 30px 30px; } img.floatingflask { padding: 0 0 10px 10px; float: right; } div.footer { text-align: right; color: #888; padding: 10px; font-size: 14px; width: 650px; margin: 0 auto 40px auto; } div.footer a { color: #888; text-decoration: underline; } div.related { line-height: 32px; color: #888; } div.related ul { padding: 0 0 0 10px; } div.related a { color: #444; } /* -- body styles ----------------------------------------------------------- */ a { color: #004B6B; text-decoration: underline; } a:hover { color: #6D4100; text-decoration: underline; } div.body { padding-bottom: 40px; /* saved for footer */ } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; margin: 30px 0px 10px 0px; padding: 0; } {% if theme_index_logo %} div.indexwrapper h1 { text-indent: -999999px; background: url({{ theme_index_logo }}) no-repeat center center; height: {{ theme_index_logo_height }}; } {% endif %} div.body h2 { font-size: 180%; } div.body h3 { font-size: 150%; } div.body h4 { font-size: 130%; } div.body h5 { font-size: 100%; } div.body h6 { font-size: 100%; } a.headerlink { color: white; padding: 0 4px; text-decoration: none; } a.headerlink:hover { color: #444; background: #eaeaea; } div.body p, div.body dd, div.body li { line-height: 1.4em; } div.admonition { background: #fafafa; margin: 20px -30px; padding: 10px 30px; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; } div.admonition p.admonition-title { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; font-size: 24px; margin: 0 0 10px 0; padding: 0; line-height: 1; } div.admonition p.last { margin-bottom: 0; } div.highlight{ background-color: white; } dt:target, .highlight { background: #FAF3E8; } div.note { background-color: #eee; border: 1px solid #ccc; } div.seealso { background-color: #ffc; border: 1px solid #ff6; } div.topic { background-color: #eee; } div.warning { background-color: #ffe4e4; border: 1px solid #f66; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre, tt { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.85em; } img.screenshot { } tt.descname, tt.descclassname { font-size: 0.95em; } tt.descname { padding-right: 0.08em; } img.screenshot { -moz-box-shadow: 2px 2px 4px #eee; -webkit-box-shadow: 2px 2px 4px #eee; box-shadow: 2px 2px 4px #eee; } table.docutils { border: 1px solid #888; -moz-box-shadow: 2px 2px 4px #eee; -webkit-box-shadow: 2px 2px 4px #eee; box-shadow: 2px 2px 4px #eee; } table.docutils td, table.docutils th { border: 1px solid #888; padding: 0.25em 0.7em; } table.field-list, table.footnote { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } table.footnote { margin: 15px 0; width: 100%; border: 1px solid #eee; } table.field-list th { padding: 0 0.8em 0 0; } table.field-list td { padding: 0; } table.footnote td { padding: 0.5em; } dl { margin: 0; padding: 0; } dl dd { margin-left: 30px; } pre { padding: 0; margin: 15px -30px; padding: 8px; line-height: 1.3em; padding: 7px 30px; background: #eee; border-radius: 2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; } dl pre { margin-left: -60px; padding-left: 60px; } tt { background-color: #ecf0f3; color: #222; /* padding: 1px 2px; */ } tt.xref, a tt { background-color: #FBFBFB; } a:hover tt { background: #EEE; } Flask-Gravatar-0.4.2/docs/_themes/flask_small/theme.conf000066400000000000000000000002701250376552500231500ustar00rootroot00000000000000[theme] inherit = basic stylesheet = flasky.css nosidebar = true pygments_style = flask_theme_support.FlaskyStyle [options] index_logo = '' index_logo_height = 120px github_fork = '' Flask-Gravatar-0.4.2/docs/_themes/flask_theme_support.py000066400000000000000000000114131250376552500233400ustar00rootroot00000000000000# flasky extensions. flasky pygments style based on tango style from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal class FlaskyStyle(Style): background_color = "#f8f8f8" default_style = "" styles = { # No corresponding class for the following: #Text: "", # class: '' Whitespace: "underline #f8f8f8", # class: 'w' Error: "#a40000 border:#ef2929", # class: 'err' Other: "#000000", # class 'x' Comment: "italic #8f5902", # class: 'c' Comment.Preproc: "noitalic", # class: 'cp' Keyword: "bold #004461", # class: 'k' Keyword.Constant: "bold #004461", # class: 'kc' Keyword.Declaration: "bold #004461", # class: 'kd' Keyword.Namespace: "bold #004461", # class: 'kn' Keyword.Pseudo: "bold #004461", # class: 'kp' Keyword.Reserved: "bold #004461", # class: 'kr' Keyword.Type: "bold #004461", # class: 'kt' Operator: "#582800", # class: 'o' Operator.Word: "bold #004461", # class: 'ow' - like keywords Punctuation: "bold #000000", # class: 'p' # because special names such as Name.Class, Name.Function, etc. # are not recognized as such later in the parsing, we choose them # to look the same as ordinary variables. Name: "#000000", # class: 'n' Name.Attribute: "#c4a000", # class: 'na' - to be revised Name.Builtin: "#004461", # class: 'nb' Name.Builtin.Pseudo: "#3465a4", # class: 'bp' Name.Class: "#000000", # class: 'nc' - to be revised Name.Constant: "#000000", # class: 'no' - to be revised Name.Decorator: "#888", # class: 'nd' - to be revised Name.Entity: "#ce5c00", # class: 'ni' Name.Exception: "bold #cc0000", # class: 'ne' Name.Function: "#000000", # class: 'nf' Name.Property: "#000000", # class: 'py' Name.Label: "#f57900", # class: 'nl' Name.Namespace: "#000000", # class: 'nn' - to be revised Name.Other: "#000000", # class: 'nx' Name.Tag: "bold #004461", # class: 'nt' - like a keyword Name.Variable: "#000000", # class: 'nv' - to be revised Name.Variable.Class: "#000000", # class: 'vc' - to be revised Name.Variable.Global: "#000000", # class: 'vg' - to be revised Name.Variable.Instance: "#000000", # class: 'vi' - to be revised Number: "#990000", # class: 'm' Literal: "#000000", # class: 'l' Literal.Date: "#000000", # class: 'ld' String: "#4e9a06", # class: 's' String.Backtick: "#4e9a06", # class: 'sb' String.Char: "#4e9a06", # class: 'sc' String.Doc: "italic #8f5902", # class: 'sd' - like a comment String.Double: "#4e9a06", # class: 's2' String.Escape: "#4e9a06", # class: 'se' String.Heredoc: "#4e9a06", # class: 'sh' String.Interpol: "#4e9a06", # class: 'si' String.Other: "#4e9a06", # class: 'sx' String.Regex: "#4e9a06", # class: 'sr' String.Single: "#4e9a06", # class: 's1' String.Symbol: "#4e9a06", # class: 'ss' Generic: "#000000", # class: 'g' Generic.Deleted: "#a40000", # class: 'gd' Generic.Emph: "italic #000000", # class: 'ge' Generic.Error: "#ef2929", # class: 'gr' Generic.Heading: "bold #000080", # class: 'gh' Generic.Inserted: "#00A000", # class: 'gi' Generic.Output: "#888", # class: 'go' Generic.Prompt: "#745334", # class: 'gp' Generic.Strong: "bold #000000", # class: 'gs' Generic.Subheading: "bold #800080", # class: 'gu' Generic.Traceback: "bold #a40000", # class: 'gt' } Flask-Gravatar-0.4.2/docs/conf.py000066400000000000000000000143111250376552500165630ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Flask Markdown documentation build configuration file, created by # sphinx-quickstart on Sun Jul 11 16:01:54 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import re import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.append(os.path.abspath('_themes')) sys.path.append(os.path.abspath('..')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Flask Gravatar' copyright = u'2011, Zelenyak Alexander' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # Get the version string. Cannot be done with import! with open(os.path.join('..', 'flask_gravatar', 'version.py'), 'rt') as f: version = re.search( '__version__\s*=\s*"(?P.*)"\n', f.read() ).group('version') # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. #pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'flask_small' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ['_themes'] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'FlaskGravatardoc' html_theme_options = { 'index_logo': '', 'github_fork': 'zzzsochi/Flask-Gravatar', } # -- Options for Intersphinx mapping ------------------------------------------ # See intersphinx_mapping = { 'python': ('https://docs.python.org/2.7/', None), 'flask': ('http://flask.pocoo.org/docs/', None), } Flask-Gravatar-0.4.2/docs/index.rst000066400000000000000000000060551250376552500171330ustar00rootroot00000000000000================ Flask-Gravatar ================ .. currentmodule:: flask_gravatar .. raw:: html

travis-ci badge coveralls.io badge

This is small and simple integration `gravatar`_ into `flask`_. .. _flask: http://flask.pocoo.org .. _gravatar: http://gravatar.com Contents -------- .. contents:: :local: :depth: 1 :backlinks: none .. _installation: Installation ============ Flask-Gravatar is on PyPI so all you need is: .. code-block:: console $ pip install Flask-Gravatar The development version can be downloaded from `its page at GitHub `_. .. code-block:: console $ git clone https://github.com/zzzsochi/flask-gravatar.git $ cd flask-gravatar $ python setup.py develop $ ./run-tests.sh .. _usage: Usage ===== Initialize with flask application and default parameters: .. code-block:: python gravatar = Gravatar(app, size=100, rating='g', default='retro', force_default=False, force_lower=False, use_ssl=False, base_url=None) Then in your template: .. code-block:: jinja {{ 'zzz.sochi@gmail.com' | gravatar }} Bigger and adult: .. code-block:: jinja {{ 'zzz.sochi@gmail.com' | gravatar(size=200, rating='x') }} Parameters ---------- All parameters are described in `gravatar documentation`_. .. _gravatar documentation: http://gravatar.com/site/implement/images .. _api: API === .. class:: flask_gravatar.Gravatar(app, size=100, rating='g', default='retro', force_default=False, force_lower=False) Simple object for create gravatar link. :param app: Your Flask app instance :type app: flask.Flask :param size: Default size for avatar :type size: int :type size: str :param rating: Default rating :type rating: str :param default: Default type for unregistred emails :type default: str :param force_default: Build only default avatars :type force_default: bool :param force_lower: Make email.lower() before build link :type force_lower: bool .. method:: __call__(email, \*\*kw) Build gravatar link. :param email: Email for create link :param kw: Reload defaults Default parameters. May change in runtime. .. attribute:: size .. attribute:: rating .. attribute:: default .. attribute:: force_default .. attribute:: force_lower .. include:: ../CHANGES .. include:: ../CONTRIBUTING.rst License ======= .. include:: ../LICENSE .. include:: ../AUTHORS Flask-Gravatar-0.4.2/flask_gravatar/000077500000000000000000000000001250376552500173235ustar00rootroot00000000000000Flask-Gravatar-0.4.2/flask_gravatar/__init__.py000066400000000000000000000076731250376552500214510ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2014 Andrew Grigorev. # Copyright (C) 2014 Nauman Ahmad. # Copyright (C) 2014 Tom Powell. # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. """Small extension for Flask to make using Gravatar easy.""" import hashlib from flask import _request_ctx_stack, request, has_request_context try: from flask import _app_ctx_stack except ImportError: # pragma: no cover _app_ctx_stack = None from .version import __version__ # Which stack should we use? _app_ctx_stack is new in 0.9 connection_stack = _app_ctx_stack or _request_ctx_stack class Gravatar(object): """Simple object for gravatar link creation. .. code-block:: python gravatar = Gravatar(app, size=100, rating='g', default='retro', force_default=False, force_lower=False, use_ssl=False, base_url=None ) """ def __init__(self, app=None, size=100, rating='g', default='retro', force_default=False, force_lower=False, use_ssl=None, base_url=None, **kwargs): """Initialize the Flask-Gravatar extension. :param app: Your Flask app instance :param size: Default size for avatar :param rating: Default rating :param default: Default type for unregistred emails :param force_default: Build only default avatars :param force_lower: Make email.lower() before build link :param use_ssl: Use https rather than http :param base_url: Use custom base url for build link """ self.size = size self.rating = rating self.default = default self.force_default = force_default self.force_lower = force_lower self.use_ssl = use_ssl self.base_url = base_url self.app = None if app is not None: self.init_app(app, **kwargs) def init_app(self, app): """Initialize the Flask-Gravatar extension for the specified application. :param app: The application. """ if not hasattr(app, 'extensions'): app.extensions = {} app.jinja_env.filters.setdefault('gravatar', self) app.extensions['gravatar'] = self def __call__(self, email, size=None, rating=None, default=None, force_default=None, force_lower=False, use_ssl=None, base_url=None): """Build gravatar link.""" if size is None: size = self.size if rating is None: rating = self.rating if default is None: default = self.default if force_default is None: force_default = self.force_default if force_lower is None: force_lower = self.force_lower if force_lower: email = email.lower() if use_ssl is None: use_ssl = self.use_ssl if use_ssl is None and has_request_context(): use_ssl = request.headers.get('X-Forwarded-Proto', request.scheme) == 'https' if base_url is None: base_url = self.base_url if base_url is not None: url = base_url + 'avatar/' else: if use_ssl: url = 'https://secure.gravatar.com/avatar/' else: url = 'http://www.gravatar.com/avatar/' hash = hashlib.md5(email.encode('utf-8')).hexdigest() link = '{url}{hash}'\ '?s={size}&d={default}&r={rating}'.format(**locals()) if force_default: link = link + '&f=y' return link __all__ = ('Gravatar', '__version__') Flask-Gravatar-0.4.2/flask_gravatar/version.py000066400000000000000000000010251250376552500213600ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. """Version information for Flask-Gravatar. This file is imported by ``flask_gravatar.__init__``, and parsed by ``setup.py`` as well as ``docs/conf.py``. """ # Do not change the format of this next line. Doing so risks breaking # setup.py and docs/conf.py __version__ = "0.4.2" Flask-Gravatar-0.4.2/pytest.ini000066400000000000000000000005671250376552500163750ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. [pytest] addopts = --clearcache --pep8 --ignore=docs --cov=flask_gravatar --cov-report=term-missing tests flask_gravatar Flask-Gravatar-0.4.2/run-tests.sh000077500000000000000000000005151250376552500166400ustar00rootroot00000000000000#!/bin/sh # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. pep257 flask_gravatar && \ sphinx-build -qnNW docs docs/_build/html && \ python setup.py test Flask-Gravatar-0.4.2/setup.cfg000066400000000000000000000005741250376552500161630ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. [build_sphinx] source-dir = docs/ build-dir = docs/_build all_files = 1 [bdist_wheel] universal = 1 [sdist] force-manifest=1 Flask-Gravatar-0.4.2/setup.py000066400000000000000000000044571250376552500160600ustar00rootroot00000000000000# coding: utf8 """Small extension for Flask to make usage of Gravatar service easy.""" import os import re import sys from setuptools import setup from setuptools.command.test import test as TestCommand class PyTest(TestCommand): user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')] def initialize_options(self): TestCommand.initialize_options(self) try: from ConfigParser import ConfigParser except ImportError: from configparser import ConfigParser config = ConfigParser() config.read("pytest.ini") self.pytest_args = config.get("pytest", "addopts").split(" ") def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): # import here, cause outside the eggs aren't loaded import pytest errno = pytest.main(self.pytest_args) sys.exit(errno) # Get the version string. Cannot be done with import! with open(os.path.join('flask_gravatar', 'version.py'), 'rt') as f: version = re.search( '__version__\s*=\s*"(?P.*)"\n', f.read() ).group('version') tests_require = [ 'pytest-cache>=1.0', 'pytest-cov>=1.8.0', 'pytest-pep8>=1.0.6', 'pytest>=2.6.1', 'coverage<4.0a1' ] setup( name='Flask-Gravatar', version=version, author='Alexander Zelenyak aka ZZZ', author_email='zzz.sochi@gmail.com', description=__doc__, license='BSD', long_description=open('README.rst').read(), platforms='any', url='https://github.com/zzzsochi/Flask-Gravatar/', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Python Modules', ], install_requires=[ 'Flask', ], extras_require={ 'docs': ['sphinx'], }, tests_require=tests_require, cmdclass={'test': PyTest}, packages=['flask_gravatar'], ) Flask-Gravatar-0.4.2/tests/000077500000000000000000000000001250376552500154765ustar00rootroot00000000000000Flask-Gravatar-0.4.2/tests/test_core.py000066400000000000000000000047761250376552500200550ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. """General unit tests.""" import sys from unittest import TestCase from flask import Flask from flask_gravatar import Gravatar # PY2/3 compatibility if sys.version_info[0] == 3: def b(s): return s.encode("latin-1") else: def b(s): return s class FlaskTestCase(TestCase): """Mix-in class for creating the Flask application.""" def setUp(self): app = Flask(__name__) app.config['DEBUG'] = True app.config['TESTING'] = True app.logger.disabled = True self.app = app def tearDown(self): self.app = None class TestGravatar(FlaskTestCase): def test_constructor(self): Gravatar(self.app) def test_init_app(self): gravatar = Gravatar() if hasattr(self.app, 'extensions'): del self.app.extensions gravatar.init_app(self.app) def test_extension_call(self): gravatar = Gravatar(self.app) link = gravatar('email@example.com', use_ssl=True) assert link == ('https://secure.gravatar.com/avatar/' '5658ffccee7f0ebfda2b226238b1eb6e?s=100&d=retro&r=g') link = gravatar('email@example.com') assert link == ('http://www.gravatar.com/avatar/' '5658ffccee7f0ebfda2b226238b1eb6e?s=100&d=retro&r=g') link = gravatar('email@example.com', base_url='http://example.com/') assert link == ('http://example.com/avatar/' '5658ffccee7f0ebfda2b226238b1eb6e?s=100&d=retro&r=g') link = gravatar('email@example.com', force_default=True) assert '&f=y' in link def test_secure_request(self): gravatar = Gravatar(self.app) @self.app.route('/') def index(email): return gravatar(email) client = self.app.test_client() response = client.get('/email@example.com', base_url='https://localhost') secure_link = gravatar('email@example.com', use_ssl=True) assert b(secure_link) == response.data def test_parameters(self): gravatar = Gravatar(self.app, force_lower=True) assert gravatar('email@example.com') == gravatar('Email@EXAMPLE.com', force_lower=None) Flask-Gravatar-0.4.2/tox.ini000066400000000000000000000005551250376552500156540ustar00rootroot00000000000000# This file is part of Flask-Gravatar # Copyright (C) 2015 CERN. # # Flask-Gravatar is free software; you can redistribute it and/or modify # it under the terms of the Revised BSD License; see LICENSE file for # more details. [tox] envlist = py26, py27, py33, py34 [testenv] deps = pytest pytest-cov pytest-pep8 commands = {envpython} setup.py test