Exemple #1
0
 def publishTraverse(self, request, name):
     raise NotFound(self, name, request)
 def add(self, names):
     raise NotFound(self.context, names, self.request)
 def disable(self):
     """ See IFacetedSubtyper
     """
     raise NotFound(self.context, 'disable', self.request)
Exemple #4
0
 def publishTraverse(self, request, name):
     if self.uid is None:
         self.uid = name
     else:
         raise NotFound(self, name, request)
     return self
 def publishTraverse(self, request, name):
     if self.tg is None:  # ../@@not_translated_yet/translationgroup
         self.tg = TranslationManager(name)
     else:
         raise NotFound(self, name, request)
     return self
Exemple #6
0
    def publishTraverse(self, request, name):
        if name == 'index.html':
            return self.index

        raise NotFound(self, name, request)
Exemple #7
0
 def __call__(self, scalename='thumb'):
     if self.display(scalename):
         return self.img(scalename)
     raise NotFound(self.request, scalename)
 def traverse(self, name):
     bookingCalendar = queryAdapter(self.context, IBookingCalendar, name='')
     if bookingCalendar is None:
         raise NotFound(self.context, name, self.request)
     bookingCalendar.request = self.request
     return bookingCalendar
Exemple #9
0
 def publishTraverse(self, request, name):
     if self.transition is None:
         self.transition = name
     else:
         raise NotFound(self, name, request)
     return self
Exemple #10
0
 def publishTraverse(self, request, name):
     view = zope.component.queryMultiAdapter((self, request), name=name)
     if view is None or not IMethodPublisher.providedBy(view):
         raise NotFound(self, name, request)
     return view
Exemple #11
0
 def __call__(self):
     photo = self.context.photo
     if not photo:
         raise NotFound(self.context, u'photo', self.request)
     self.request.response.setHeader('Content-Type', "image/jpeg")
     return photo
Exemple #12
0
 def publishTraverse(self, request, name):
     """See IBrowserPublisher."""
     # By default, a LaunchpadView cannot be traversed through.
     # Those that can be must override this method.
     raise NotFound(self, name, request=request)
Exemple #13
0
 def publishTraverse(self, request, name):
     """See zope.publisher.interfaces.browser.IBrowserPublisher."""
     raise NotFound(self.context, name)
Exemple #14
0
 def publishTraverse(self, request, name):
     '''See interface IBrowserPublisher'''
     raise NotFound(None, name)
Exemple #15
0
    def __call__(self):
        uid = None
        itemindex = 0
        if self.request.form.has_key('uid'):
            uid = self.request.form['uid']
        if self.request.form.has_key('itemindex'):
            itemindex = self.request.form['itemindex']

        if uid is not None:
            query = {'UID': uid}
            pdt = getToolByName(self.context, 'portal_discussion')
            cat = getToolByName(self.context, 'uid_catalog')
            resbrains = cat.searchResults(query)
            if len(resbrains) == 1:
                item = resbrains[0]
                contobj = item.getObject()
                fullpath = item.getPath()
                splitpath = fullpath.split('/')[:-1]
                prettypath = '/' + '/'.join(splitpath)
                URLsuffix = getListingTemplateForContextParent(item)
                pathlink = self.context.portal_url(
                ) + prettypath + '/' + URLsuffix
                pathtitle = prettypath

                lasttimestamp = DateTime().timeTime()
                lastcommentid = '0'
                showxmorelink = True
                commentscount = 0
                xmorecomments = 0
                replydict = []

                isDiscussable = contobj.isDiscussable()
                canReply = canreply(contobj)
                jsondata = getjsondata(self.context, replydict,
                                       self.context.portal_url(),
                                       contobj.absolute_url())

                if isDiscussable:
                    dobj = pdt.getDiscussionFor(contobj)
                    alldiscussions = dobj.objectValues()
                    alldiscussions.sort(
                        lambda x, y: cmp(x.modified(), y.modified()),
                        reverse=True)
                    maxdispcomments = get_displaycountforlist()
                    lastxdiscussions = alldiscussions[:maxdispcomments]

                    commentscount = dobj.replyCount(contobj)
                    if commentscount > maxdispcomments:
                        showxmorelink = True
                        xmorecomments = commentscount - maxdispcomments
                    elif commentscount > 0 and commentscount <= maxdispcomments:
                        showxmorelink = False
                        xmorecomments = 0
                    else:
                        showxmorelink = True
                        commentscount = 0
                        xmorecomments = 0

                    if len(alldiscussions) > 0:
                        lasttimestamp = alldiscussions[0].modified().timeTime()
                        lastcommentid = alldiscussions[0].id

                    lastxdiscussions.sort(
                        lambda x, y: cmp(x.modified(), y.modified()))
                    for eachdisc in lastxdiscussions:
                        reply = dobj.getReply(eachdisc.id)
                        if reply <> None:
                            replydict.append({
                                'depth': 0,
                                'object': reply,
                                'showoutput': True
                            })

                    other_data = {
                        'view_type': 'listview',
                        'canreply': str(canReply)
                    }

                    jsondata = getjsondata(self.context, replydict,
                                           self.context.portal_url(),
                                           contobj.absolute_url(), other_data)

                return self.template(item_type=contobj.portal_type,
                                     item_type_title=contobj.Type(),
                                     item=item,
                                     pathlink=pathlink,
                                     pathtitle=pathtitle,
                                     contobj=contobj,
                                     showxmorelink=showxmorelink,
                                     xmorecomments=xmorecomments,
                                     allowdiscussion=isDiscussable,
                                     usercanreply=canReply,
                                     uid=uid,
                                     reply_dict=jsondata,
                                     title=contobj.Title(),
                                     commentcount=commentscount,
                                     lasttimestamp=lasttimestamp,
                                     lastcommentid=lastcommentid,
                                     itemindex=itemindex,
                                     view_type='listview')
            else:
                raise NotFound('Object not found for request', 'Not found',
                               self.request)
        else:
            raise NotFound('uid is not passed', 'Not found', self.request)