| commit 62: | f4eda24447fa |
| parent 61: | 586f695a0046 |
| branch: | default |
remove some dumb logging. Handle anonymous users better. Fix link admin. put back find_module patch. Fix tempita with \r
- View ianb's profile
-
ianb's public repos »
- toppcloud
- Tempita
- dtopt
- wsgi-peps
- WebOb
- libcloud-vbox
- pip
- paste-import
- silverlining
- WSGIProxy
- FlatAtomPub
- PageCollector
- WaitForIt
- WebTest
- formencode
- virtualenv
- bbdocs
- bbdocs-lib
- PasteScript
- wave-experiments
- frank-lib
- doctestjs
- referrertrack
- CmdUtils
- silverlog
- silverlog-lib
- wphp
- twilljs
- paster-create-experiment
- INITools
- PickyWiki
- ScriptTest
- PasteDeploy
- silverlining-refactor
- geodns
- geodns-lib
- geoalchemy
- datacatalog
- datacatalog-lib
- dozer
- wikistorage
- Send message
12 months ago
Changed (Δ318 bytes):
raw changeset »
lib/python/appengine_monkey.py (9 lines added, 9 lines removed)
lib/python/tempita/__init__.py (8 lines added, 3 lines removed)
pickywiki/db.py (7 lines added, 8 lines removed)
Up to file-list lib/python/appengine_monkey.py:
| … | … | @@ -52,15 +52,15 @@ def release_lock(): |
52 |
52 |
def load_module(fullname, fp, filename, etc): |
53 |
53 |
pass |
54 |
54 |
|
55 |
#@patch(imp) |
|
56 |
#def find_module(subname, path): |
|
57 |
# for p in path: |
|
58 |
# full_py = os.path.join(p, subname + '.py') |
|
59 |
# full_dir = os.path.join(p, subname, '__init__.py') |
|
60 |
# for full in full_py, full_dir: |
|
61 |
# if os.path.exists(full): |
|
62 |
# return open(full), full, None |
|
63 |
# return None, '', None |
|
55 |
@patch(imp) |
|
56 |
def find_module(subname, path): |
|
57 |
for p in path: |
|
58 |
full_py = os.path.join(p, subname + '.py') |
|
59 |
full_dir = os.path.join(p, subname, '__init__.py') |
|
60 |
for full in full_py, full_dir: |
|
61 |
if os.path.exists(full): |
|
62 |
return open(full), full, None |
|
63 |
return None, '', None |
|
64 |
64 |
|
65 |
65 |
@patch(imp) |
66 |
66 |
def get_magic(): |
Up to file-list lib/python/tempita/__init__.py:
| … | … | @@ -148,7 +148,7 @@ class Template(object): |
148 |
148 |
% (args[0],)) |
149 |
149 |
kw = args[0] |
150 |
150 |
ns = self.default_namespace.copy() |
151 |
ns['__ |
|
151 |
ns['__template_name__'] = self.name |
|
152 |
152 |
ns.update(self.namespace) |
153 |
153 |
ns.update(kw) |
154 |
154 |
result, defs, inherit = self._interpret(ns) |
| … | … | @@ -292,6 +292,7 @@ class Template(object): |
292 |
292 |
try: |
293 |
293 |
exec code in ns |
294 |
294 |
except: |
295 |
import logging; logging.warn('Code: %r' % code) |
|
295 |
296 |
exc_info = sys.exc_info() |
296 |
297 |
e = exc_info[1] |
297 |
298 |
if e.args: |
| … | … | @@ -770,8 +771,12 @@ def parse_expr(tokens, name, context=()) |
770 |
771 |
expr = expr.strip() |
771 |
772 |
if expr.startswith('py:'): |
772 |
773 |
expr = expr[3:].lstrip(' \t') |
773 |
if expr.startswith('\n'): |
|
774 |
expr = expr[1:] |
|
774 |
if expr.startswith('\n') or expr.startswith('\r'): |
|
775 |
expr = expr.lstrip('\r\n') |
|
776 |
if '\r' in expr: |
|
777 |
expr = expr.replace('\r\n', '\n') |
|
778 |
expr = expr.replace('\r', '') |
|
779 |
expr += '\n' |
|
775 |
780 |
else: |
776 |
781 |
if '\n' in expr: |
777 |
782 |
raise TemplateError( |
Up to file-list pickywiki/db.py:
| … | … | @@ -26,9 +26,9 @@ class _AnonymousUser(object): |
26 |
26 |
|
27 |
27 |
anonymous = _AnonymousUser() |
28 |
28 |
|
29 |
def current_user( |
|
29 |
def current_user(return_anonymous=True): |
|
30 |
30 |
user = users.get_current_user() |
31 |
if user is None |
|
31 |
if user is None and return_anonymous: |
|
32 |
32 |
return anonymous |
33 |
33 |
return user |
34 |
34 |
|
| … | … | @@ -158,7 +158,7 @@ class Page(db.Expando): |
158 |
158 |
type='redirect', |
159 |
159 |
content=new_path, |
160 |
160 |
created=datetime.now(), |
161 |
last_edited_by=current_user( |
|
161 |
last_edited_by=current_user(False), |
|
162 |
162 |
title='Redirect to %s' % new_path, |
163 |
163 |
parent_page=None) |
164 |
164 |
return redir_page |
| … | … | @@ -176,7 +176,8 @@ class Page(db.Expando): |
176 |
176 |
template='puzzle', |
177 |
177 |
resource='cog', |
178 |
178 |
binary='cog', |
179 |
redirect='arrow_right' |
|
179 |
redirect='arrow_right', |
|
180 |
link='arrow_right') |
|
180 |
181 |
|
181 |
182 |
def icon_img(self): |
182 |
183 |
return html('<img src="%s" class="icon">' % self.icon()) |
| … | … | @@ -285,7 +286,7 @@ class Page(db.Expando): |
285 |
286 |
assert self.path != '__unspecified__' |
286 |
287 |
if not self.uuid: |
287 |
288 |
self.uuid = self.make_uuid() |
288 |
self.last_updated_by = current_user( |
|
289 |
self.last_updated_by = current_user(False) |
|
289 |
290 |
storage = get_request().storage |
290 |
291 |
if storage: |
291 |
292 |
if self.last_edited_by: |
| … | … | @@ -513,11 +514,10 @@ class KnownUser(db.Model): |
513 |
514 |
def check_user(cls): |
514 |
515 |
"""Puts the current user into the database if necessary""" |
515 |
516 |
user = current_user() |
516 |
if user is None |
|
517 |
if user is None or user.email() is None: |
|
517 |
518 |
return |
518 |
519 |
key = 'known_user.%s' % user.email() |
519 |
520 |
result = memcache.get(key) |
520 |
import logging; logging.warn('data %r', [user, key, result]) |
|
521 |
521 |
if result is None: |
522 |
522 |
existing = cls.all().filter('user=', user).get() |
523 |
523 |
if existing is None: |
| … | … | @@ -600,7 +600,6 @@ def has_permission(application, permissi |
600 |
600 |
result = True |
601 |
601 |
break |
602 |
602 |
perms = RolePermission.permissions(role) |
603 |
import logging; logging.warn('got perms %r for %s for %s' % (perms, role, user)) |
|
604 |
603 |
if application in perms and permission in perms[application]: |
605 |
604 |
result = True |
606 |
605 |
break |
