Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Moving managedvms/memcache to pymemcache for better python3 support. #200

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

Merged
merged 1 commit into from
Feb 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions 9 managed_vms/memcache/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
import os

from flask import Flask
import memcache
from pymemcache.client.base import Client as MemcacheClient


app = Flask(__name__)


# [START client]
memcache_addr = os.environ.get('MEMCACHE_PORT_11211_TCP_ADDR', 'localhost')
memcache_port = os.environ.get('MEMCACHE_PORT_11211_TCP_PORT', '11211')
memcache_client = memcache.Client([
'{}:{}'.format(memcache_addr, memcache_port)])
memcache_port = os.environ.get('MEMCACHE_PORT_11211_TCP_PORT', 11211)
memcache_client = MemcacheClient((memcache_addr, int(memcache_port)))
# [END client]


Expand All @@ -37,7 +36,7 @@ def index():
if not memcache_client.get('counter'):
memcache_client.set('counter', 0)

value = memcache_client.incr('counter')
value = memcache_client.incr('counter', 1)

return 'Value is {}'.format(value)
# [END example]
Expand Down
6 changes: 3 additions & 3 deletions 6 managed_vms/memcache/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@


def test_index():
main.memcache_client.set('counter', 0)

if main.memcache_client.get('counter') is None:
try:
main.memcache_client.set('counter', 0)
except Exception:
pytest.skip('Memcache is unavailable.')

main.app.testing = True
Expand Down
2 changes: 1 addition & 1 deletion 2 managed_vms/memcache/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==0.10.1
gunicorn==19.4.5
python-memcached==1.57
pymemcache==1.3.5
6 changes: 5 additions & 1 deletion 6 requirements-py27-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
gcloud==0.10.1
google-api-python-client==1.5.0
oauth2client==2.0.0.post1
requests[security]==2.9.1
beautifulsoup4==4.4.1
coverage==4.1b2
Flask==0.10.1
Expand All @@ -18,7 +22,7 @@ Werkzeug==0.11.4
nose-timer==0.6.0
Flask-SQLAlchemy==2.1
PyMySQL==0.7.1
python-memcached==1.57
pymemcache==1.3.5
PyCrypto==2.6.1
flaky==3.1.0
Django==1.9.2
Expand Down
6 changes: 5 additions & 1 deletion 6 requirements-py34-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
gcloud==0.10.1
google-api-python-client==1.5.0
oauth2client==2.0.0.post1
requests[security]==2.9.1
beautifulsoup4==4.4.1
coverage==4.1b2
Flask==0.10.1
Expand All @@ -18,7 +22,7 @@ Werkzeug==0.11.4
nose-timer==0.6.0
Flask-SQLAlchemy==2.1
PyMySQL==0.7.1
python-memcached==1.57
pymemcache==1.3.5
PyCrypto==2.6.1
flaky==3.1.0
Django==1.9.2
Expand Down
4 changes: 0 additions & 4 deletions 4 requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions 5 tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ envlist = pep8, py27, py34, gae
[testenv]
passenv = *
basepython = python2.7
deps =
-rrequirements.txt
examples =
bigquery/api
blog/introduction_to_data_models_in_cloud_datastore
Expand Down Expand Up @@ -38,7 +36,6 @@ commands =

[testenv:py27]
deps =
{[testenv]deps}
-rrequirements-py27-dev.txt
commands =
python scripts/run-tests.py {posargs:{[testenv]examples}}
Expand All @@ -55,7 +52,6 @@ commands =
[testenv:py34]
basepython = python3.4
deps =
{[testenv]deps}
-rrequirements-py34-dev.txt
commands =
python scripts/run-tests.py {posargs:{[testenv]examples}}
Expand All @@ -72,7 +68,6 @@ commands =

[testenv:gae]
deps =
{[testenv]deps}
-rrequirements-py27-dev.txt
examples =
appengine/app_identity/signing
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.