-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
2,842 additions
and
709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
[run] | ||
source = nti.externalization | ||
|
||
omit = | ||
*/flycheck_*py | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
raise NotImplementedError | ||
raise AssertionError | ||
if __name__ == .__main__.: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
""" | ||
.. $Id$ | ||
Externalization | ||
""" | ||
|
||
from __future__ import print_function, absolute_import, division | ||
__docformat__ = "restructuredtext en" | ||
|
||
logger = __import__('logging').getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,44 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
""" | ||
.. $Id$ | ||
Extension points for connecting to Pyramid. | ||
XXX TODO: Define get_current_request as a zope.hookable function | ||
and let the application determine what framework to connect to. | ||
""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
__docformat__ = "restructuredtext en" | ||
|
||
logger = __import__('logging').getLogger(__name__) | ||
# stdlib imports | ||
import threading | ||
|
||
try: | ||
from pyramid.threadlocal import ThreadLocalManager | ||
from pyramid.threadlocal import get_current_request | ||
|
||
ThreadLocalManager = ThreadLocalManager | ||
get_current_request = get_current_request | ||
|
||
except ImportError: | ||
import threading | ||
|
||
class ThreadLocalManager(threading.local): | ||
|
||
def __init__(self, default=None): | ||
self.stack = [] | ||
self.default = default | ||
def get_current_request(): | ||
return None | ||
else: # pragma: no cover | ||
get_current_request = get_current_request | ||
|
||
def push(self, info): | ||
self.stack.append(info) | ||
class ThreadLocalManager(threading.local): | ||
|
||
set = push # b/c | ||
def __init__(self, default=None): | ||
self.stack = [] | ||
self.default = default | ||
|
||
def pop(self): | ||
if self.stack: | ||
return self.stack.pop() | ||
def push(self, info): | ||
self.stack.append(info) | ||
|
||
def get(self): | ||
try: | ||
return self.stack[-1] | ||
except IndexError: | ||
return self.default() | ||
set = push # b/c | ||
|
||
def clear(self): | ||
self.stack[:] = [] | ||
def pop(self): | ||
if self.stack: | ||
return self.stack.pop() | ||
|
||
def get_current_request(): | ||
return None | ||
def get(self): | ||
try: | ||
return self.stack[-1] | ||
except IndexError: | ||
return self.default() |
Oops, something went wrong.