[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/registration - __init__.py:1.3 changeregistrations.pt:1.2
Fred L. Drake, Jr.
fred@zope.com
Wed, 2 Jul 2003 15:15:07 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/services/registration
In directory cvs.zope.org:/tmp/cvs-serv874/app/browser/services/registration
Modified Files:
__init__.py changeregistrations.pt
Log Message:
Make the utility registration pages work again.
=== Zope3/src/zope/app/browser/services/registration/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/services/registration/__init__.py:1.2 Mon Jun 30 18:44:14 2003
+++ Zope3/src/zope/app/browser/services/registration/__init__.py Wed Jul 2 15:15:01 2003
@@ -126,19 +126,19 @@
def applyUpdates(self):
message = ''
if 'submit_update' in self.request.form:
- active = self.request.form.get(self.name)
- if active == "disable":
+ id = self.request.form.get(self.name)
+ if id == "disable":
active = self.context.active()
if active is not None:
- self.context.deactivate(active)
+ self.context.activate(None)
message = "Disabled"
else:
for info in self.context.info():
- if info['id'] == active:
- if not info['active']:
- self.context.activate(info['registration'])
- message = "Updated"
-
+ if info['id'] == id and not info['active']:
+ self.context.activate(info['registration'])
+ message = "Updated"
+ break
+
return message
def update(self):
@@ -149,19 +149,32 @@
'absolute_url', self.request)
)
- registrations = self.context.info()
+ registrations = self.context.info(True)
# This is OK because registrations is just a list of dicts
registrations = removeAllProxies(registrations)
inactive = 1
+ have_none = False
for info in registrations:
if info['active']:
inactive = None
else:
info['active'] = None
- info['summary'] = info['registration'].implementationSummary()
+ reg = info['registration']
+ if reg is not None:
+ info['summary'] = reg.implementationSummary()
+ else:
+ info['summary'] = ""
+ info['id'] = 'disable'
+ have_none = True
+
+ if not have_none:
+ # Add a dummy registration since the stack removes trailing None.
+ registrations.append({"active": False,
+ "id": "disable",
+ "summary": ""})
self.inactive = inactive
self.registrations = registrations
=== Zope3/src/zope/app/browser/services/registration/changeregistrations.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/services/registration/changeregistrations.pt:1.1 Sat Jun 21 17:22:02 2003
+++ Zope3/src/zope/app/browser/services/registration/changeregistrations.pt Wed Jul 2 15:15:01 2003
@@ -12,21 +12,15 @@
"
/>
</td>
- <td><a href="."
+ <td tal:condition="python: registration['id'] != 'disable'"><a href="."
tal:attributes="href string:${view/configBase}/${registration/id}"
tal:content="registration/id"
>foo/bar</a></td>
+ <td tal:condition="python: registration['id'] == 'disable'"
+ i18n:translate="">
+ Disabled</td>
<td tal:content="structure registration/summary">
Registration summary
</td>
- </tr>
- <tr>
- <td><input type="radio" name="Roles" value="disable"
- tal:attributes="
- name view/name;
- checked view/inactive;
- "
- /></td>
- <td><em>Disable</em></td>
</tr>
</table>