--- a/app/soc/logic/models/base.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/logic/models/base.py Sat Dec 06 11:21:41 2008 +0000
@@ -46,13 +46,14 @@
on arguments passed to __init__.
"""
- def __init__(self, model, base_model=None,
+ def __init__(self, model, base_model=None, scope_logic=None,
name=None, skip_properties=None):
"""Defines the name, key_name and model for this entity.
"""
self._model = model
self._base_model = base_model
+ self._scope_logic = scope_logic
if name:
self._name = name
@@ -70,6 +71,12 @@
return self._model
+ def getScopeLogic(self):
+ """Returns the logic of the enclosing scope
+ """
+
+ return self._scope_logic
+
def _updateField(self, model, name, value):
"""Hook called when a field is updated.
--- a/app/soc/logic/models/host.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/logic/models/host.py Sat Dec 06 11:21:41 2008 +0000
@@ -23,6 +23,7 @@
from soc.logic.models import role
+from soc.logic.models import sponsor as sponsor_logic
import soc.models.host
import soc.models.role
@@ -32,12 +33,13 @@
"""Logic methods for the Host model.
"""
- def __init__(self):
+ def __init__(self, model=soc.models.host.Host,
+ base_model=soc.models.role.Role, scope_logic=sponsor_logic):
"""Defines the name, key_name and model for this entity.
"""
- super(Logic, self).__init__(model=soc.models.host.Host,
- base_model=soc.models.role.Role)
+ super(Logic, self).__init__(model=model, base_model=base_model,
+ scope_logic=scope_logic)
logic = Logic()
--- a/app/soc/logic/models/program.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/logic/models/program.py Sat Dec 06 11:21:41 2008 +0000
@@ -23,6 +23,7 @@
from soc.logic.models import base
+from soc.logic.models import sponsor as sponsor_logic
import soc.models.program
@@ -31,11 +32,13 @@
"""Logic methods for the Program model
"""
- def __init__(self, model=soc.models.program.Program, base_model=None):
+ def __init__(self, model=soc.models.program.Program,
+ base_model=None, scope_logic=sponsor_logic):
"""Defines the name, key_name and model for this entity.
"""
- super(Logic, self).__init__(model=model, base_model=base_model)
+ super(Logic, self).__init__(model=model, base_model=base_model,
+ scope_logic=scope_logic)
logic = Logic()
--- a/app/soc/logic/models/role.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/logic/models/role.py Sat Dec 06 11:21:41 2008 +0000
@@ -31,11 +31,13 @@
"""Logic methods for the Role model.
"""
- def __init__(self, model=soc.models.role.Role, base_model=None):
+ def __init__(self, model=soc.models.role.Role,
+ base_model=None, scope_logic=None):
"""Defines the name, key_name and model for this entity.
"""
- super(Logic, self).__init__(model, base_model=base_model)
+ super(Logic, self).__init__(model, base_model=base_model,
+ scope_logic=scope_logic)
logic = Logic()
--- a/app/soc/views/helper/params.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/views/helper/params.py Sat Dec 06 11:21:41 2008 +0000
@@ -82,6 +82,9 @@
new_params = {}
new_params['rights'] = rights
+ new_params['scope_logic'] = params['logic'].getScopeLogic()
+
+
new_params['create_redirect'] = '/%(url_name)s' % params
new_params['edit_redirect'] = '/%(url_name)s/edit' % params
new_params['missing_redirect'] = '/%(url_name)s/create' % params
--- a/app/soc/views/models/host.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/views/models/host.py Sat Dec 06 11:21:41 2008 +0000
@@ -92,7 +92,6 @@
new_params['rights'] = rights
new_params['logic'] = soc.logic.models.host.logic
- new_params['scope_logic'] = sponsor_logic
new_params['scope_view'] = sponsor_view
new_params['logic'] = soc.logic.models.host.logic
--- a/app/soc/views/models/program.py Sat Dec 06 11:21:01 2008 +0000
+++ b/app/soc/views/models/program.py Sat Dec 06 11:21:41 2008 +0000
@@ -53,7 +53,6 @@
new_params = {}
new_params['logic'] = soc.logic.models.program.logic
- new_params['scope_logic'] = sponsor_logic
new_params['scope_view'] = sponsor_view
new_params['name'] = "Program"