code: def has_change_permission(self, page, lang, method=None):
          if method != 'POST':
              return True
          if self.change_page():
              return True
          if lang:
              perm = self.user.has_perm(
                  'pages.can_manage_%s' % lang.replace('-', '_')
              )
              if perm:
                  return True
              perm_func = getattr(self, 'manage (%s)_page' % lang)
              if perm_func(page):
                  return True
          perm_func = getattr(self, 'manage hierarchy_page')
          if perm_func(page):
              return True
          else:
              for ancestor in page.get_ancestors():
                  if perm_func(ancestor):
                      return True
          return False