Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rename get_base_model to get_entry_base_model, it's more explicit

  • Loading branch information...
commit d60992349f114a8f0e4bfebdccdba5382625eed8 1 parent 37f1baf
@Fantomas42 authored
Showing with 11 additions and 9 deletions.
  1. +6 −4 zinnia/models/entry.py
  2. +5 −5 zinnia/tests/entry.py
View
10 zinnia/models/entry.py
@@ -479,10 +479,12 @@ class Meta(CoreEntry.Meta):
abstract = True
-def get_base_model():
+def get_entry_base_model():
"""
- Determine the base Model to inherit in the
- Entry Model, this allow to overload it.
+ Determine the base abstract model to inherit from,
+ to build the final Entry model.
+ This mecanizm allows extension and customization of
+ the Entry model class.
"""
if not ENTRY_BASE_MODEL:
return EntryAbstractClass
@@ -499,7 +501,7 @@ def get_base_model():
return EntryAbstractClass
-class Entry(get_base_model()):
+class Entry(get_entry_base_model()):
"""
The final Entry model based on inheritence.
"""
View
10 zinnia/tests/entry.py
@@ -16,7 +16,7 @@
from zinnia.models.entry import Entry
from zinnia.managers import PUBLISHED
from zinnia.flags import PINGBACK, TRACKBACK
-from zinnia.models.entry import get_base_model
+from zinnia.models.entry import get_entry_base_model
from zinnia.models.entry import EntryAbstractClass
from zinnia.tests.utils import datetime
from zinnia import url_shortener as shortener_settings
@@ -310,18 +310,18 @@ def setUp(self):
def tearDown(self):
entry.ENTRY_BASE_MODEL = self.original_entry_base_model
- def test_get_base_model(self):
+ def test_get_entry_base_model(self):
entry.ENTRY_BASE_MODEL = ''
- self.assertEquals(get_base_model(), EntryAbstractClass)
+ self.assertEquals(get_entry_base_model(), EntryAbstractClass)
entry.ENTRY_BASE_MODEL = 'mymodule.myclass'
try:
with warnings.catch_warnings(record=True) as w:
- self.assertEquals(get_base_model(), EntryAbstractClass)
+ self.assertEquals(get_entry_base_model(), EntryAbstractClass)
self.assertTrue(issubclass(w[-1].category, RuntimeWarning))
except AttributeError:
# Fail under Python2.5, because of'warnings.catch_warnings'
pass
entry.ENTRY_BASE_MODEL = 'zinnia.models.entry.EntryAbstractClass'
- self.assertEquals(get_base_model(), EntryAbstractClass)
+ self.assertEquals(get_entry_base_model(), EntryAbstractClass)
Please sign in to comment.
Something went wrong with that request. Please try again.