Permalink
Browse files

Can't have and output to stdout when running under wsgi

  • Loading branch information...
1 parent ef8e196 commit 027f8b16fe458412e416eeca013a38d614cc35b0 @cnorthwood cnorthwood committed Nov 17, 2010
@@ -26,7 +26,6 @@ def import_data(self, metadata, output):
flag_status = FlagStatus(order=i)
flag_status.name = name
- print tr[1][0].attrib['alt']
flag_status.status = status
@@ -33,7 +33,6 @@ def _cache(self, f, key, args=None, kwargs=None, timeout=None):
key = '.'.join(['molly', self.conf.local_name, key])
value = cache.get(key)
if value is None:
- print "Fetching"
value = f(*(args or ()), **(kwargs or {}))
cache.set(key, value, timeout)
return value
@@ -75,7 +75,6 @@ def save(self, force_insert=False, force_update=False, *args, **kwargs):
resized.save(self.get_filename(), format='jpeg')
self.content_type = 'image/jpeg'
except IOError, e:
- print "ERR", e
try:
resized.convert('RGB').save(self.get_filename(), format='jpeg')
self.content_type = 'image/jpeg'
@@ -35,7 +35,6 @@ def render(self, context):
width = float('inf')
url, width = self.url.resolve(context), min(width, context['device'].max_image_width)
- print "width", width, (self.max_width or 9999), context['device'].max_image_width
eis = resize_external_image(url, width)
@@ -33,7 +33,6 @@ def range(start, stop=None, step=1):
start, stop = step-step, start
while start < stop:
- print start
yield start
start += step
@@ -70,7 +69,6 @@ def update(self, feed):
r'(\d\d [A-Za-z]{3} \d{4}( - \d\d [A-Za-z]{3} \d{4})?: )?(.+)',
x_item.find('title').text,
)
- print match.group(3)
series.title = match.group(3)
except AttributeError:
series.title = x_item.find('title').text
@@ -87,8 +85,6 @@ def update(self, feed):
dt_start = parse_date(x_item.find(ns_xcal['dtstart']).text)
dt_end = parse_date(x_item.find(ns_xcal['dtend']).text)
- #print feed_data, '\n\n\n'
-
for i, dt in enumerate(x_item.findall(ns_dc['date'])):
item, created = Item.objects.get_or_create(
@@ -177,12 +173,6 @@ def handle_noargs(self, **options):
for x_item in feed_data.entries:
guid, last_modified = x_item.id, datetime(*x_item.date_parsed[:7])
- #print x_item.link
- #if x_item.link != 'http://www.dailyinfo.co.uk/events.php?colname=Lectures%2C+Seminars+and+Conferences&period=7&eventday=10&eventmonth=12&eventyear=2009#70276':
- # continue
-
- print x_item.items()
-
for i in items:
if i.guid == guid:
item = i
@@ -224,7 +214,6 @@ def handle_noargs(self, **options):
try:
item.location_point = Point(float(x_item.geo_long),
float(x_item.geo_lat))
- print x_item.geo_lat, x_item.geo_long
except AttributeError, ValueError:
for link in venue_et.findall('.//a'):
match = Command.GOOGLE_MAPS_LINK_RE.match(link.attrib.get('href', ''))
@@ -245,7 +234,6 @@ def handle_noargs(self, **options):
break
item.location_point = self.postcode_to_point(match.groups(0)[0])
- print item.location_point
break
location_data[venue_id] = item.location_name, item.location_address, item.location_point
@@ -20,7 +20,6 @@ def update(self, feed):
feed_data = feedparser.parse(feed.rss_url)
try:
feed.last_modified = struct_to_datetime(feed_data.feed.updated_parsed)
- print "RRRRRRRRRRRRRRRRRRRRRRRRRRRR"
except:
feed.last_modified = parse_date(feed_data.headers.get('last-modified', datetime.now().strftime("%a, %d %b %Y %H:%M:%S +0000")))
@@ -41,7 +41,6 @@ def oxp_id(value):
@register.filter(name="load_oxp_json")
def load_oxp_json(value):
- print value['uri']
return simplejson.load(urllib.urlopen(value['uri']+'.json'))[0]
@register.filter(name="oxp_portal_url")
@@ -390,11 +390,7 @@ def initial_context(self, request, id):
data = request.raw_post_data if request.method == 'POST' else None
response = request.urlopen(url, data)
evaluation = etree.parse(response, parser = etree.HTMLParser(recover=False))
-
- print etree.tostring(evaluation)
evaluation = transform(evaluation, 'sakai/evaluation/detail.xslt', {'id': id})
-
- print etree.tostring(evaluation)
# The evaluations tool doesn't give us a non-OK status if we need to authenticate. Instead,
# we need to check for the login box (handily picked out by the XSL stylesheet).
@@ -408,7 +404,6 @@ def initial_context(self, request, id):
'response_url': response.geturl(),
}
add_children_to_context(evaluation, context)
- print context['state_message']
return context
@BreadcrumbFactory
@@ -439,7 +434,6 @@ def handle_GET(self, request, context, id):
return self.render(request, context, 'sakai/evaluation/detail')
def handle_POST(self, request, context, id):
- print context['response_url']
if context['response_url'].startswith(self.build_url('direct/eval-evaluation/%s/take_eval?' % id)):
return self.handle_GET(request, context, id)
@@ -69,7 +69,6 @@ def breadcrumb(cls, request, context):
def handle_GET(cls, request, context):
- print context['complex_shorten']
try:
path = request.GET['path']
except (KeyError):
View
@@ -36,8 +36,6 @@ def __call__(self, request, *args, **kwargs):
return TimedOutView(request, self, *args, **kwargs)
request.secure_session['last_accessed'] = datetime.now()
- print type(self).__mro__
-
return super(SecureView, self).__call__(request, *args, **kwargs)
class TimedOutView(BaseView):
@@ -114,7 +112,6 @@ def handle_POST(self, request, context):
forms = context['form'], context['user_sessions'], context['external_service_tokens']
if not all(form.is_valid() for form in forms):
- print [form.errors for form in forms]
return self.render(request, context, 'auth/index')
if context['has_pin'] and form.cleaned_data['old_pin'] != request.secure_session['pin']:
@@ -51,15 +51,13 @@ def h(*args, **kwargs):
def geocode(query, providers):
results = []
for provider in providers:
- print "PROVIDER", provider
results += provider.geocode(query)
return results
@_cached(lambda lon,lat,local_name=None:{'lon': lon, 'lat':lat, 'local_name':local_name})
def reverse_geocode(lon, lat, providers):
results = []
for provider in providers:
- print "PROVIDER", provider
results += provider.reverse_geocode(lon, lat)
return results
View
@@ -14,9 +14,8 @@ def initialise_logging():
mod = __import__(log_module_name, globals(), locals(), ['config_logging'], -1)
config_logging = mod.config_logging
except (ImportError, AttributeError):
- print "No config for %s" % app_name
+ pass
else:
- print "Found config for %s" % app_name
config_logging()
View
@@ -18,17 +18,13 @@ def __init__(self):
self.listener_thread = threading.Thread(target=self.listener)
self.listener_thread.start()
-
-
-
def listener(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while not self.close_down_event.is_set():
try:
sock.bind(('localhost', logging.handlers.DEFAULT_TCP_LOGGING_PORT))
- print "Bound"
except socket.error:
time.sleep(1)
else:
@@ -68,7 +68,6 @@ def perform_query(cls, surname, forename):
results = []
for ldap_result in ldap_results:
- print ldap_result
results.append({
'cn': cls.first_or_none(ldap_result, 'cn'),
@@ -27,7 +27,6 @@ def reverse_geocode(self, lon, lat):
data = urllib2.urlopen(self.REVERSE_GEOCODE_URL % params)
- print self.REVERSE_GEOCODE_URL % params
json = simplejson.load(data)
if not json:
return []
@@ -50,9 +50,6 @@ def _load_from_csv(self, reader, entity_type, source):
else:
postcode = postcode_abbrev
postcode_abbrev = postcode_abbrev.replace(' ', '')
-
- if not (i % 100):
- print "%7d %7d %s" % (i, j, postcode)
try:
easting, northing = int(easting), int(northing)
@@ -72,7 +72,6 @@ def import_data(self, metadata, output):
rss_urls.append(attrib['xmlUrl'])
self.update_podcast(podcast)
- print "Updated %r" % podcast.title
except Exception, e:
if not failure_logged:
logger.exception("Update of podcast %r failed.", attrib['xmlUrl'])
@@ -28,10 +28,7 @@ def perform_search(self, request, query, application=None):
results += app.perform_search(request, query, application is not None)
except Exception, e:
logger.exception("Application search provider raised exception: %r", e)
- print results
-
- print apps
return results
def find_applications(self):
@@ -52,7 +49,4 @@ def find_applications(self):
else:
search_provider = _temp.ApplicationSearch(application)
- self.applications[application.local_name] = search_provider
- print self.applications
-
-
+ self.applications[application.local_name] = search_provider
View
@@ -44,9 +44,6 @@ def __init__(self, *args, **kwargs):
def emit(self, record):
- print dir(record)
- print record.exc_info
- print record.exc_text
if hasattr(record, 'traceback'):
self.error_handler.emit(record)

0 comments on commit 027f8b1

Please sign in to comment.