[Zope3-checkins] SVN: Zope3/trunk/src/bugtracker/ Okay,
fixed the bugtracker, so it will work again. We really, really need
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Sep 2 18:49:58 EDT 2004
Log message for revision 27433:
Okay, fixed the bugtracker, so it will work again. We really, really need
ftests here; I will add some another time, but I won't forget, promised.
Changed:
U Zope3/trunk/src/bugtracker/browser/bug.py
U Zope3/trunk/src/bugtracker/browser/tracker_overview.pt
U Zope3/trunk/src/bugtracker/bug.py
U Zope3/trunk/src/bugtracker/configure.zcml
U Zope3/trunk/src/bugtracker/mail.py
U Zope3/trunk/src/bugtracker/vocabulary.py
-=-
Modified: Zope3/trunk/src/bugtracker/browser/bug.py
===================================================================
--- Zope3/trunk/src/bugtracker/browser/bug.py 2004-09-02 21:33:03 UTC (rev 27432)
+++ Zope3/trunk/src/bugtracker/browser/bug.py 2004-09-02 22:49:58 UTC (rev 27433)
@@ -24,11 +24,10 @@
from zope.interface import implements
from zope.proxy import removeAllProxies
from zope.schema.vocabulary import getVocabularyRegistry
-from zope.security.checker import getChecker, ProxyFactory
+from zope.security.checker import getChecker
from zope.structuredtext.html import HTML
from zope.app import zapi
-from zope.app.container.contained import contained
from zope.app.dublincore.interfaces import IZopeDublinCore
from zope.app.form import CustomWidgetFactory
from zope.app.form.browser import TextWidget, TextAreaWidget, DropdownWidget
@@ -43,19 +42,23 @@
class BugBaseView(object):
"""Get's all the fancy expressions for the attribute values."""
- def created(self):
+ def getCreated(self):
dc = IZopeDublinCore(self.context)
formatter = self.request.locale.dates.getFormatter('dateTime', 'short')
return formatter.format(dc.created)
- def modified(self):
+ created = property(getCreated)
+
+ def getModified(self):
dc = IZopeDublinCore(self.context)
formatter = self.request.locale.dates.getFormatter('dateTime', 'short')
if dc.modified is None:
return self.created()
return formatter.format(dc.modified)
- def submitter(self):
+ modified = property(getModified)
+
+ def getSubmitter(self):
registry = getVocabularyRegistry()
users = registry.get(self.context, 'Users')
id = self.context.submitter
@@ -65,7 +68,9 @@
# There is no principal for this id, so let's just fake one.
return {'id': id, 'login': id, 'title': id, 'description': id}
- def description(self):
+ submitter = property(getSubmitter)
+
+ def getDescription(self):
ttype = getattr(self.context.description, 'ttype', None)
if ttype is not None:
source = zapi.createObject(None, self.context.description.ttype,
@@ -76,29 +81,39 @@
html = self.context.description
return html
- def status(self):
+ description = property(getDescription)
+
+ def getStatus(self):
registry = getVocabularyRegistry()
types = registry.get(zapi.getParent(self.context), 'Stati')
return types.getTerm(self.context.status)
- def type(self):
+ status = property(getStatus)
+
+ def getType(self):
registry = getVocabularyRegistry()
types = registry.get(zapi.getParent(self.context), 'BugTypes')
return types.getTerm(self.context.type)
- def release(self):
+ type = property(getType)
+
+ def getRelease(self):
if self.context.release is None:
return u'not specified'
registry = getVocabularyRegistry()
types = registry.get(zapi.getParent(self.context), 'Releases')
return types.getTerm(self.context.release)
- def priority(self):
+ release = property(getRelease)
+
+ def getPriority(self):
registry = getVocabularyRegistry()
types = registry.get(zapi.getParent(self.context), 'Priorities')
return types.getTerm(self.context.priority)
- def owners(self):
+ priority = property(getPriority)
+
+ def getOwners(self):
registry = getVocabularyRegistry()
vocab = registry.get(self.context, 'Users')
userTerms = []
@@ -111,7 +126,9 @@
{'id': id, 'login': id, 'title': id, 'description': id})
return userTerms
+ owners = property(getOwners)
+
# Make a custom widget for the vocabulary, so that default values are
# retrieved from the vocabulary and not the field.
class ManagableVocabularyWidget(DropdownWidget):
@@ -291,9 +308,7 @@
def canChangeDependencies(self):
deps = IBugDependencies(self.context)
- deps = contained(deps, self.context, name='Dependencies')
- proxy = ProxyFactory(deps)
- checker = getChecker(proxy)
+ checker = getChecker(deps)
try:
checker.check_setattr(deps, 'dependencies')
except (Unauthorized, ForbiddenAttribute):
Modified: Zope3/trunk/src/bugtracker/browser/tracker_overview.pt
===================================================================
--- Zope3/trunk/src/bugtracker/browser/tracker_overview.pt 2004-09-02 21:33:03 UTC (rev 27432)
+++ Zope3/trunk/src/bugtracker/browser/tracker_overview.pt 2004-09-02 22:49:58 UTC (rev 27433)
@@ -88,7 +88,7 @@
<div class="row" i18n:domain="bugtracker">
<div class="control">
- <form action="./@@+/AddBug=" method="post">
+ <form action="./+/AddBug.html=" method="post">
<input type="submit" name="add" value="Add Bug"
i18n:attributes="value add-bug-button"/>
</form>
@@ -167,7 +167,7 @@
</div>
<div class="row" i18n:domain="bugtracker">
<div class="control">
- <form action="./@@+/AddBug=" method="post">
+ <form action="./+/AddBug.html=" method="post">
<input type="submit" name="add" value="Add Bug"
i18n:attributes="value add-bug-button"/>
</form>
Modified: Zope3/trunk/src/bugtracker/bug.py
===================================================================
--- Zope3/trunk/src/bugtracker/bug.py 2004-09-02 21:33:03 UTC (rev 27432)
+++ Zope3/trunk/src/bugtracker/bug.py 2004-09-02 22:49:58 UTC (rev 27433)
@@ -112,7 +112,7 @@
__used_for__ = IBug
def __init__(self, context):
- self.context = context
+ self.context = self.__parent__ = context
self._annotations = IAnnotations(context)
if not self._annotations.get(DependencyKey):
self._annotations[DependencyKey] = ()
Modified: Zope3/trunk/src/bugtracker/configure.zcml
===================================================================
--- Zope3/trunk/src/bugtracker/configure.zcml 2004-09-02 21:33:03 UTC (rev 27432)
+++ Zope3/trunk/src/bugtracker/configure.zcml 2004-09-02 22:49:58 UTC (rev 27433)
@@ -111,7 +111,7 @@
<content class=".vocabulary.ManagableVocabulary">
<allow interface="zope.schema.interfaces.IVocabulary"/>
<allow interface="zope.schema.interfaces.IVocabularyTokenized"/>
- <allow attributes="default"/>
+ <allow attributes="default title"/>
<require
permission="bugtracker.ManageBugTracker"
attributes="add delete"
@@ -150,6 +150,13 @@
<allow attributes="principal title"/>
</content>
+ <content class=".mail.MailSubscriptions">
+ <require
+ permission="bugtracker.EditBug"
+ attributes="addSubscriptions removeSubscriptions" />
+ <allow attributes="getSubscriptions" />
+ </content>
+
<!-- Bug Tracker related configuration -->
<interface
@@ -193,27 +200,32 @@
<adapter
factory=".vocabulary.StatusVocabulary"
provides=".interfaces.IStatusVocabulary"
- for=".interfaces.IBugTracker" />
+ for=".interfaces.IBugTracker"
+ trusted="True" />
<adapter
factory=".vocabulary.ReleaseVocabulary"
provides=".interfaces.IReleaseVocabulary"
- for=".interfaces.IBugTracker" />
+ for=".interfaces.IBugTracker"
+ trusted="True" />
<adapter
factory=".vocabulary.PriorityVocabulary"
provides=".interfaces.IPriorityVocabulary"
- for=".interfaces.IBugTracker" />
+ for=".interfaces.IBugTracker"
+ trusted="True" />
<adapter
factory=".vocabulary.BugTypeVocabulary"
provides=".interfaces.IBugTypeVocabulary"
- for=".interfaces.IBugTracker" />
+ for=".interfaces.IBugTracker"
+ trusted="True" />
<adapter
factory=".mail.MailSubscriptions"
provides=".interfaces.IMailSubscriptions"
- for=".interfaces.IBugTracker" />
+ for=".interfaces.IBugTracker"
+ trusted="True" />
<!-- Bug related configuration -->
@@ -262,7 +274,7 @@
<require
permission="bugtracker.ViewBug"
- attributes="dependencies dependents"/>
+ attributes="dependencies dependents findChildren"/>
<require
permission="bugtracker.EditBug"
@@ -275,12 +287,14 @@
<adapter
factory=".bug.BugDependencyAdapter"
provides=".interfaces.IBugDependencies"
- for=".interfaces.IBug" />
+ for=".interfaces.IBug"
+ trusted="True" />
<adapter
factory=".mail.MailSubscriptions"
provides=".interfaces.IMailSubscriptions"
- for=".interfaces.IBug" />
+ for=".interfaces.IBug"
+ trusted="True" />
<!-- File and Image Attachment related configuration -->
Modified: Zope3/trunk/src/bugtracker/mail.py
===================================================================
--- Zope3/trunk/src/bugtracker/mail.py 2004-09-02 21:33:03 UTC (rev 27432)
+++ Zope3/trunk/src/bugtracker/mail.py 2004-09-02 22:49:58 UTC (rev 27433)
@@ -33,17 +33,17 @@
implements(IMailSubscriptions)
def __init__(self, context):
- self.context = context
+ self.context = self.__parent__ = context
self._annotations = IAnnotations(context)
if not self._annotations.get(SubscriberKey):
self._annotations[SubscriberKey] = ()
def getSubscriptions(self):
- "See zopeproducts.messageboard.interfaces.IMailSubscriptions"
+ "See bugtracker.interfaces.IMailSubscriptions"
return self._annotations[SubscriberKey]
def addSubscriptions(self, emails):
- "See zopeproducts.messageboard.interfaces.IMailSubscriptions"
+ "See bugtracker.interfaces.IMailSubscriptions"
subscribers = list(self._annotations[SubscriberKey])
for email in emails:
if email not in subscribers:
@@ -51,7 +51,7 @@
self._annotations[SubscriberKey] = tuple(subscribers)
def removeSubscriptions(self, emails):
- "See zopeproducts.messageboard.interfaces.IMailSubscriptions"
+ "See bugtracker.interfaces.IMailSubscriptions"
subscribers = list(self._annotations[SubscriberKey])
for email in emails:
if email in subscribers:
Modified: Zope3/trunk/src/bugtracker/vocabulary.py
===================================================================
--- Zope3/trunk/src/bugtracker/vocabulary.py 2004-09-02 21:33:03 UTC (rev 27432)
+++ Zope3/trunk/src/bugtracker/vocabulary.py 2004-09-02 22:49:58 UTC (rev 27433)
@@ -19,7 +19,7 @@
from persistent.dict import PersistentDict
from zope.interface import implements
-from zope.schema.interfaces import ITokenizedTerm
+from zope.schema.interfaces import ITokenizedTerm, ITitledTokenizedTerm
from zope.schema.interfaces import IVocabulary, IVocabularyTokenized
from zope.schema.vocabulary import getVocabularyRegistry
from zope.security.proxy import removeSecurityProxy
@@ -37,7 +37,7 @@
class SimpleTerm(Persistent):
"""A persistent vocabulary term."""
- implements(ITokenizedTerm)
+ implements(ITitledTokenizedTerm)
def __init__(self, value, title):
self.value = value
@@ -63,8 +63,12 @@
interface = None
def __init__(self, context):
- self.context = self._getRealContext(context)
- self.annotations = IAnnotations(self.context)
+ context = self._getRealContext(context)
+ # When we use this vocabulary as an adapter, we always get an
+ # unproxied context, but when it is used as a vocabulary, we usually
+ # get proxied context, in which case we need to unwrap it.
+ pureContext = removeSecurityProxy(context)
+ self.annotations = IAnnotations(pureContext)
if not self.annotations.get(self.key):
self.annotations[self.key] = PersistentDict()
self.annotations[self.key+'/default'] = None
@@ -168,7 +172,7 @@
class UserTerm(Persistent):
- implements(ITokenizedTerm)
+ implements(ITitledTokenizedTerm)
def __init__(self, principal):
# This is safe here, since we only read non-critical data
More information about the Zope3-Checkins
mailing list