Use PAGE_MAXRAW in both places (refactor this after it all works perfectly)

This commit is contained in:
Dannon Baker
2018-09-07 11:20:02 -04:00
parent d7a245608e
commit 3571df4e4d
@@ -72,6 +72,9 @@ _cp1252 = {
}
PAGE_MAXRAW = 10**15
def format_bool(b):
if b:
return "yes"
@@ -964,6 +967,8 @@ class PageController(BaseUIController, SharableMixin,
# Assume if item id is integer and less than 10**15, it's unencoded.
try:
decoded_id = int(item_id)
if decoded_id >= PAGE_MAXRAW:
raise ValueError("Identifier larger than maximum expected raw int, must be already encoded.")
encoded_id = self.app.security.encode_id(item_id)
except ValueError:
# It's an encoded id.
@@ -1006,8 +1011,6 @@ PAGE_CLASS_MAPPING = {
'Visualization': 'Visualization'
}
PAGE_MAXRAW = 10**15
def _placeholderRenderForEdit(trans, item_class, item_id):
return _placeholderRenderForSave(trans, item_class, item_id, encode=True)