misc: restore (but deprecate) access to .formdef in form_objects (#32730)
This commit is contained in:
parent
daf32c5a54
commit
93ffe3f9dc
|
@ -167,6 +167,8 @@ def test_substitution_variables_object(pub):
|
|||
with pytest.raises(AttributeError):
|
||||
assert substs.foobar
|
||||
|
||||
assert substs.formdef is formdef
|
||||
|
||||
def test_file_field_migration(pub):
|
||||
pub.cfg['filetypes'] = {1:
|
||||
{'mimetypes': [
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import warnings
|
||||
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from quixote import get_publisher, get_request
|
||||
|
@ -73,7 +75,10 @@ class LazyFormDefObjectsManager(object):
|
|||
status = attribute[len('count_status_'):]
|
||||
return len(self._formdef.data_class().get_ids_with_indexed_value(
|
||||
'status', 'wf-%s' % status))
|
||||
return super(LazyFormDefObjectsManager, self).__getattr__(attribute)
|
||||
if attribute == 'formdef':
|
||||
warnings.warn('Deprecated access to formdef', DeprecationWarning)
|
||||
return self._formdef
|
||||
raise AttributeError('No such attribute %r' % attribute)
|
||||
|
||||
def __len__(self):
|
||||
if self._cached_resultset:
|
||||
|
|
Loading…
Reference in New Issue