summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-03-01 23:43:56 -0500
committerChris McDonough <chrism@plope.com>2012-03-01 23:43:56 -0500
commit8114e3a023aa2c37e99acddfe4e697ee5cc180ed (patch)
tree89f044e095d924d524a307be98dc1a0f7ace6cbc
parentd82f1d93a914d483bec51d6463dcb4dc923719ee (diff)
parent13c42fd6b8c18067cb4ff20d2eebdfb4b074b14c (diff)
downloadpyramid-8114e3a023aa2c37e99acddfe4e697ee5cc180ed.tar.gz
pyramid-8114e3a023aa2c37e99acddfe4e697ee5cc180ed.tar.bz2
pyramid-8114e3a023aa2c37e99acddfe4e697ee5cc180ed.zip
Merge branch '1.3-branch'
-rw-r--r--CHANGES.txt15
-rw-r--r--docs/narr/scaffolding.rst2
-rw-r--r--pyramid/config/views.py2
-rw-r--r--pyramid/scripts/pserve.py24
4 files changed, 22 insertions, 21 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 284c45ae4..3f5819954 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -28,20 +28,7 @@ Bug Fixes
Pyramid 1.3a1.
This bug was due to the presence of an ``__iter__`` attribute on strings
- under Python 3 which is not present under strings in Python 2. I've been
- assured by multiple Python cognoscenti that this difference in behavior
- between Python 2 and Python 3 makes complete sense. Iterating over a
- string character by character is of course something everyone wants to do
- as often as possible and it would just be too darn slow to need to call a
- method in order to turn a string into a list. Announcing that a string is
- iterable by adding an ``__iter__`` to it simply canonizes its amazing,
- speedy usefulness! So lest you think that Python 3's addition of an
- ``__iter__`` to strings was a useless, pointless, harmful,
- developer-hostile change, you're clearly mistaken, and quite possibly
- brain-damaged. I feel for you. It's clearly much better to have a bug
- that goes uncaught for nine alphas and one beta and almost leads to a
- latent security hole that might have led to indiscriminate data
- disclosure.
+ under Python 3 which is not present under strings in Python 2.
1.3b1 (2012-02-26)
==================
diff --git a/docs/narr/scaffolding.rst b/docs/narr/scaffolding.rst
index 3e7b102fd..9ac579a87 100644
--- a/docs/narr/scaffolding.rst
+++ b/docs/narr/scaffolding.rst
@@ -123,7 +123,7 @@ defining your scaffold template:
paste_script_template_renderer = None
from pyramid.scaffolds import PyramidTemplate
- class CoolExtensionTemplateTemplate(PyramidTemplate):
+ class CoolExtensionTemplate(PyramidTemplate):
_template_dir = 'coolextension_scaffold'
summary = 'My cool extension'
template_renderer = staticmethod(paste_script_template_renderer)
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index 1baaefcb6..0f70c604f 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -1635,7 +1635,7 @@ class StaticURLInfo(object):
# appending a slash here if the spec doesn't have one is
# required for proper prefix matching done in ``generate``
# (``subpath = path[len(spec):]``).
- if os.path.isabs(spec):
+ if os.path.isabs(spec): # FBO windows
sep = os.sep
else:
sep = '/'
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index 2bea7376a..31a07c46f 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -9,6 +9,7 @@
# lib/site.py
import atexit
+import ctypes
import errno
import logging
import optparse
@@ -23,10 +24,24 @@ import traceback
from paste.deploy import loadapp, loadserver
+from pyramid.compat import WIN
+
from pyramid.paster import setup_logging
MAXFD = 1024
+if WIN and not hasattr(os, 'kill'): # pragma: no cover
+ # py 2.6 on windows
+ def kill(pid, sig=None):
+ """kill function for Win32"""
+ # signal is ignored, semibogus raise message
+ kernel32 = ctypes.windll.kernel32
+ handle = kernel32.OpenProcess(1, 0, pid)
+ if (0 == kernel32.TerminateProcess(handle, 0)):
+ raise OSError('No such process %s' % pid)
+else:
+ kill = os.kill
+
def main(argv=sys.argv, quiet=False):
command = PServeCommand(argv, quiet=quiet)
return command.run()
@@ -451,7 +466,7 @@ class PServeCommand(object):
if not live_pidfile(pid_file):
break
import signal
- os.kill(pid, signal.SIGTERM)
+ kill(pid, signal.SIGTERM)
time.sleep(1)
else:
self.out("failed to kill web process %s" % pid)
@@ -505,11 +520,10 @@ class PServeCommand(object):
raise
return 1
finally:
- if (proc is not None
- and hasattr(os, 'kill')):
+ if proc is not None:
import signal
try:
- os.kill(proc.pid, signal.SIGTERM)
+ kill(proc.pid, signal.SIGTERM)
except (OSError, IOError):
pass
@@ -611,7 +625,7 @@ def live_pidfile(pidfile): # pragma: no cover
pid = read_pidfile(pidfile)
if pid:
try:
- os.kill(int(pid), 0)
+ kill(int(pid), 0)
return pid
except OSError as e:
if e.errno == errno.EPERM: