예제 #1
0
    def post(self):      
        points = None
        user = None

        if self.logged_in:
            user = self.current_user
            
        listType = self.request.get('type')
        
        # NO LONGER USING "most ribbons"
        # if listType == 'topAwards':
        #    points = PointRoot.getTopAwardPoints(user)
        if listType == 'recentActivityAll':
            points = yield PointRoot.getRecentActivityAll_async(user)
        if listType == 'topViewed':            
            points = yield PointRoot.getTopViewedPoints_async(user)
        elif listType == 'topRated':
            points = yield PointRoot.getTopRatedPoints_async(user)
        elif listType == 'editorsPics':
            points = yield PointRoot.getEditorsPicks_async(user)

        template_values = {
            'points':points
        }                        
        self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
        self.response.out.write(json.dumps(
            self.template_render('pointBoxList.html', template_values)))
예제 #2
0
    def post(self):
        points = None
        user = None

        if self.logged_in:
            user = self.current_user

        listType = self.request.get('type')

        # NO LONGER USING "most ribbons"
        # if listType == 'topAwards':
        #    points = PointRoot.getTopAwardPoints(user)
        if listType == 'recentActivityAll':
            points = yield PointRoot.getRecentActivityAll_async(user)
        if listType == 'topViewed':
            points = yield PointRoot.getTopViewedPoints_async(user)
        elif listType == 'topRated':
            points = yield PointRoot.getTopRatedPoints_async(user)
        elif listType == 'editorsPics':
            points = yield PointRoot.getEditorsPicks_async(user)

        template_values = {'points': points}
        self.response.headers[
            "Content-Type"] = 'application/json; charset=utf-8'
        self.response.out.write(
            json.dumps(
                self.template_render('pointBoxList.html', template_values)))
예제 #3
0
 def checkNamespace(self, areaName): 
     bigMessage = []
     noErrors = 0
     pointCount = 0
     bigMessage.append("ooooooooooooooooooooooooooooooooooooooooooooooooooo")
     bigMessage.append("          NAMESPACE: " + areaName)
     bigMessage.append("ooooooooooooooooooooooooooooooooooooooooooooooooooo")
     
     namespace_manager.set_namespace(areaName) 
     
     # Take every point version
     query = Point.query()
     for point in query.iter():
         foundError, newMessages = self.checkPoint(point)   
         bigMessage = bigMessage + newMessages      
         if not foundError:
             noErrors = noErrors + 1
         pointCount = pointCount + 1
         
     bigMessage.append( "%d points checked. No errors detected in %d points" % (pointCount, noErrors))
     
     noErrors = 0
     rootCount = 0
     query = PointRoot.query()
     for pointRoot in query.iter():
         foundError, newMessages = self.checkRoot(pointRoot)
         bigMessage = bigMessage + newMessages
                   
         if not foundError:
             noErrors = noErrors + 1
         rootCount = rootCount + 1
         
     bigMessage.append( "%d roots checked. No errors detected in %d roots" % (rootCount, noErrors))        
     return bigMessage
예제 #4
0
    def archiveComments(self):
        results = {'result': False}
        pointRootUrlsafe = self.request.get('rootKey')
        parentCommentUrlsafe = self.request.get('parentKey')
        user = self.current_user
        
        if user and user.isAdmin:
            pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe)
            if pointRoot:
                try:
                    numArchived = pointRoot.archiveComments(parentCommentUrlsafe)
                    results = {
                        'result': True,
                        'numArchived': numArchived
                    }
                    
                except WhysaurusException as e:
                    results['error'] = str(e)                    
            else:
                results['error'] = 'Unable to find point root'

        else:
            results['error'] = 'Not authorized to archive comments'
            
        resultJSON = json.dumps(results)
        self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
        self.response.out.write(resultJSON)
예제 #5
0
    def archiveComments(self):
        results = {'result': False}
        pointRootUrlsafe = self.request.get('rootKey')
        parentCommentUrlsafe = self.request.get('parentKey')
        user = self.current_user

        if user and user.isAdmin:
            pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe)
            if pointRoot:
                try:
                    numArchived = pointRoot.archiveComments(
                        parentCommentUrlsafe)
                    results = {'result': True, 'numArchived': numArchived}

                except WhysaurusException as e:
                    results['error'] = str(e)
            else:
                results['error'] = 'Unable to find point root'

        else:
            results['error'] = 'Not authorized to archive comments'

        resultJSON = json.dumps(results)
        self.response.headers[
            "Content-Type"] = 'application/json; charset=utf-8'
        self.response.out.write(resultJSON)
예제 #6
0
    def get(self):
        user = None

        if self.logged_in:
            user = self.current_user
            
        newPoints = yield PointRoot.getRecentCurrentPoints_async(user)        
        featuredPoint = FeaturedPoint.getFeaturedPoint()
        
        # GET RECENTLY VIEWED
        if user:
            recentlyViewedPoints = user.getRecentlyViewed()
            user.getActiveNotifications()
        else:
            recentlyViewedPoints = []
        
        template_values = {
            'recentlyActive': newPoints,
            'recentlyViewed': recentlyViewedPoints,
            'featuredPoint': featuredPoint,
            'user': user,
            'showManifesto': 1,
            'thresholds': constants.SCORETHRESHOLDS,
            'currentArea':self.session.get('currentArea'),
            'currentAreaDisplayName':self.session.get('currentAreaDisplayName')
        }
        self.response.out.write(self.template_render('index.html', template_values))
예제 #7
0
    def MakeFollows(self):
        """
        # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        ADD FOLLOWS FOR ADMIN USERS
        # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
        """
        nextURL = None
        firstURL = self.request.get('nexturl')
        query = PointRoot.query().order(PointRoot.url)
        if firstURL:
            query = query.filter(PointRoot.url >= firstURL)
        pointRoots = query.fetch(11)
        if len(pointRoots) == 11:
            nextURL = pointRoots[-1].url
            pointRootsToReview = pointRoots[:10]
        else:
            pointRootsToReview = pointRoots

        i = 0
        for pointRoot in pointRootsToReview:
            pointRootKey = pointRoot.key
            followers = {}

            versions = pointRoot.getAllVersions()
            for point in versions:
                if point.version == 1:
                    followers[point.authorURL] = 'created'
                elif not point.authorURL in followers:
                    followers[point.authorURL] = 'edited'

            for comment in pointRoot.getComments():
                if not comment.userUrl in followers:
                    followers[comment.userUrl] = 'commented'

            logging.info('ROOT: %s FOLLOWERS: %s' %
                         (pointRoot.url, str(followers)))
            for url in followers.iterkeys():
                followType = followers[url]
                previousNamespace = namespace_manager.get_namespace()
                if previousNamespace and previousNamespace != '':
                    namespace_manager.set_namespace('')  # DEFAULT NAMESPACE
                    usr = WhysaurusUser.getByUrl(url)
                    namespace_manager.set_namespace(previousNamespace)
                else:
                    usr = WhysaurusUser.getByUrl(url)
                logging.info('Trying to follow for U:%s, R:%s, T:%s' %
                             (url, pointRoot.url, followType))
                f = None
                f = Follow.createFollow(usr.key, pointRootKey, followType)
                if f:
                    i = i + 1
                    logging.info('ADDED follow for U:%s, R:%s, T:%s' %
                                 (url, pointRoot.url, followType))

        logging.info('Added %d follows' % i)
        if nextURL:
            t = Task(url="/MakeFollows", params={'nexturl': nextURL})
            t.add(queue_name="notifications")
            logging.info('Requeing MakeFollows task to start at url %s ' %
                         nextURL)
예제 #8
0
    def mutate(self, info, pointID, commentID):
        user = info.context.current_user
        if user and user.isAdmin:

            pointRoot = PointRootModel.getByUrlsafe(pointID)
            numArchived = pointRoot.archiveComments(commentID)
            return ArchiveComment(numArchived=numArchived)
예제 #9
0
 def checkNamespace(self, areaName): 
     bigMessage = []
     noErrors = 0
     pointCount = 0
     bigMessage.append("ooooooooooooooooooooooooooooooooooooooooooooooooooo")
     bigMessage.append("          NAMESPACE: " + areaName)
     bigMessage.append("ooooooooooooooooooooooooooooooooooooooooooooooooooo")
     
     namespace_manager.set_namespace(areaName) 
     
     # Take every point version
     query = Point.query()
     for point in query.iter():
         foundError, newMessages = self.checkPoint(point)   
         bigMessage = bigMessage + newMessages      
         if not foundError:
             noErrors = noErrors + 1
         pointCount = pointCount + 1
         
     bigMessage.append( "%d points checked. No errors detected in %d points" % (pointCount, noErrors))
     
     noErrors = 0
     rootCount = 0
     query = PointRoot.query()
     for pointRoot in query.iter():
         foundError, newMessages = self.checkRoot(pointRoot)
         bigMessage = bigMessage + newMessages
                   
         if not foundError:
             noErrors = noErrors + 1
         rootCount = rootCount + 1
         
     bigMessage.append( "%d roots checked. No errors detected in %d roots" % (rootCount, noErrors))        
     return bigMessage
예제 #10
0
 def mutate(self, info, comment_data):
     point_root = PointRootModel.getByUrlsafe(comment_data.pointID)
     user = info.context.current_user
     text = comment_data.text
     comment = CommentModel.create(text, user, point_root,
                                   comment_data.parentCommentID)
     PointModel.addNotificationTask(point_root.key, user.key, 3, text)
     return NewComment(comment=comment)
예제 #11
0
 def resolve_newPoints(self, info, **args):
     results, nextCursor, more = PointRootModel.getRecentCurrentPointsPage(
         user=info.context.current_user,
         cursor=args.get('cursor', None),
         limit=args.get('limit', 5))
     return PagedPoints(cursor=nextCursor.urlsafe(),
                        points=results,
                        hasMore=more)
예제 #12
0
    def MakeFollows(self):
        """
        # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        ADD FOLLOWS FOR ADMIN USERS
        # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
        """
        nextURL = None
        firstURL = self.request.get('nexturl')
        query = PointRoot.query().order(PointRoot.url)
        if firstURL:
            query = query.filter(PointRoot.url >= firstURL)
        pointRoots = query.fetch(11)
        if len(pointRoots) == 11:
            nextURL = pointRoots[-1].url
            pointRootsToReview = pointRoots[:10]
        else:
            pointRootsToReview = pointRoots
        
        i = 0
        for pointRoot in pointRootsToReview:
            pointRootKey = pointRoot.key
            followers = {}     
                          
            versions = pointRoot.getAllVersions()
            for point in versions:
                if point.version == 1:
                    followers[point.authorURL] = 'created'         
                elif not point.authorURL in followers:
                    followers[point.authorURL] = 'edited'  
            
            for comment in pointRoot.getComments():
                if not comment.userUrl in followers:
                    followers[comment.userUrl] = 'commented'  
                
            logging.info('ROOT: %s FOLLOWERS: %s' % (pointRoot.url, str(followers)))       
            for url in followers.iterkeys():
                followType = followers[url]
                previousNamespace = namespace_manager.get_namespace()
                if previousNamespace and previousNamespace != '':                
                    namespace_manager.set_namespace('') # DEFAULT NAMESPACE
                    usr = WhysaurusUser.getByUrl(url)
                    namespace_manager.set_namespace(previousNamespace)
                else:
                    usr = WhysaurusUser.getByUrl(url)
                logging.info('Trying to follow for U:%s, R:%s, T:%s' % (url, pointRoot.url, followType))
                f = None
                f = Follow.createFollow(usr.key, pointRootKey, followType)
                if f:
                    i = i + 1
                    logging.info('ADDED follow for U:%s, R:%s, T:%s' % (url, pointRoot.url, followType))

                       
        logging.info('Added %d follows' % i)
        if nextURL:
            t = Task(url="/MakeFollows", params={'nexturl':nextURL})
            t.add(queue_name="notifications")
            logging.info('Requeing MakeFollows task to start at url %s ' % nextURL)
예제 #13
0
 def get(self):
     countSaved = 0
     pointsRootsQuery = PointRoot.gql("WHERE editorsPick = TRUE")
     pointRoots = pointsRootsQuery.fetch(100)
     for pointRoot in pointRoots:
         pointRoot.editorsPickSort = 100000
         pointRoot.put()
         countSaved = countSaved + 1
     template_values = {'message': "Edits made: %d" % countSaved}
     path = os.path.join(os.path.dirname(__file__),
                         '../templates/message.html')
     self.response.out.write(template.render(path, template_values))
 def get(self):
     countSaved = 0
     pointsRootsQuery = PointRoot.gql("WHERE editorsPick = TRUE")
     pointRoots = pointsRootsQuery.fetch(100)
     for pointRoot in pointRoots:
         pointRoot.editorsPickSort = 100000
         pointRoot.put()
         countSaved = countSaved + 1
     template_values = {
         'message': "Edits made: %d" % countSaved
     }
     path = os.path.join(os.path.dirname(__file__), '../templates/message.html')
     self.response.out.write(template.render(path, template_values))
     
예제 #15
0
 def joshTaskTemp(self):
     results = {'result': False}
     pointRootUrlsafe = self.request.get('rootKey')
     pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe)
     if pointRoot:
         try: 
             #pointRoot.setTop();
         except WhysaurusException as e:
             results['error'] = str(e)
     else:
         results['error'] = 'Unable to find point root'
         
     resultJSON = json.dumps(results)
     self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
     self.response.out.write(resultJSON)
예제 #16
0
    def saveComment(self):
        results = {'result': False}
        text = self.request.get('commentText')
        pointRootUrlsafe = self.request.get('p')
        parentCommentUrlsafe = self.request.get('parentKey')

        user = self.current_user
        if user:
            try:
                pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe)
                if pointRoot:
                    comment = Comment.create(text, user, pointRoot,
                                             parentCommentUrlsafe)
                    if comment:
                        pst_date = PST.convert(comment.date)
                        results = {
                            'result':
                            True,
                            'userName':
                            user.name,
                            'userURL':
                            user.url,
                            'avatar_url':
                            user.avatar_url if hasattr(user, 'avatar_url') else
                            '/static/img/icon_triceratops_black_47px.png',
                            'text':
                            text,
                            'date':
                            pst_date.strftime('%b. %d, %Y, %I:%M %p'),
                            'parentUrlsafe':
                            parentCommentUrlsafe,
                            'myUrlSafe':
                            comment.key.urlsafe(),
                            'level':
                            comment.level
                        }
                        Point.addNotificationTask(pointRoot.key, user.key, 3,
                                                  text)

                else:
                    results[
                        'error'] = 'Unable to find the point to add this comment'
            except WhysaurusException as e:
                results['error'] = str(e)
        resultJSON = json.dumps(results)
        self.response.headers[
            "Content-Type"] = 'application/json; charset=utf-8'
        self.response.out.write(resultJSON)
예제 #17
0
    def PopulateCreators(self):
        prs = PointRoot.query()
        cnt = 0
        bypassed = 0;
        for pr in prs.iter():
            updated = pr.populateCreatorUrl()
            if updated:
                # Just run one for now..
                cnt += 1
                if cnt > 250:
                    logging.warn('Populate Update Stop - Updated: %d Bypassed: %d' % (cnt, bypassed))
                    return
            else:
                bypassed += 1

        logging.warning('Populate Update Complete! - Updated: %d Bypassed: %d' % (cnt, bypassed))
예제 #18
0
 def getMainPageLeft(self):
     
     newPoints = PointRoot.getRecentCurrentPoints()
     featuredPoint = FeaturedPoint.getFeaturedPoint()
         
     vals = {
         'recentlyActive': newPoints,
         'featuredPoint': featuredPoint,
         'user': self.current_user
     }
     self.response.headers["Content-Type"] = 'application/json; charset=utf-8'        
     html = self.template_render('mainPageLeftColumn.html', vals)
     resultJSON = json.dumps({
         'result': True,
         'html': html,
     }) 
     self.response.out.write(resultJSON) 
예제 #19
0
    def get(self):

        query = PointRoot.query()
        bigMessage = []
        i = 0
        doc_index = search.Index(name="points")

        for pointRoot in query.iter():
            doc_index.delete(pointRoot.url)
            doc_index.delete(pointRoot.key.urlsafe())
            pointRoot.getCurrent().addToSearchIndexNew()
            bigMessage.append('Added %s' % pointRoot.url)
            i = i + 1

        bigMessage.append("Insertions made: %d" % i)

        template_values = {'message': bigMessage}
        path = os.path.join(os.path.dirname(__file__),
                            '../templates/message.html')
        self.response.out.write(template.render(path, template_values))
    def get(self):

        query = PointRoot.query()
        bigMessage = []
        i = 0
        doc_index = search.Index(name="points")

        for pointRoot in query.iter():                     
            doc_index.delete(pointRoot.url)
            doc_index.delete(pointRoot.key.urlsafe())
            pointRoot.getCurrent().addToSearchIndexNew()
            bigMessage.append('Added %s' % pointRoot.url)
            i = i + 1

        bigMessage.append("Insertions made: %d" % i)

        template_values = {
            'message': bigMessage
        }
        path = os.path.join(os.path.dirname(__file__), '../templates/message.html')
        self.response.out.write(template.render(path, template_values))
예제 #21
0
 def pointRootsMap(self, f, taskURL, firstURL = None):
     nextURL = None        
     query = PointRoot.query().order(PointRoot.url)
                     
     if firstURL:
         query = query.filter(PointRoot.url >= firstURL)
         
     pointRoots = query.fetch(11)
     if len(pointRoots) == 11:
         nextURL = pointRoots[-1].url
         pointRootsToReview = pointRoots[:10]
     else:
         pointRootsToReview = pointRoots   
     
     for pointRoot in pointRootsToReview:
         f(pointRoot)
         
     if nextURL:
         t = Task(url=taskURL, params={'nexturl':nextURL})
         t.add(queue_name="notifications")
         logging.info('Requeing task to start at url %s ' % nextURL)            
예제 #22
0
    def pointRootsMap(self, f, taskURL, firstURL=None):
        nextURL = None
        query = PointRoot.query().order(PointRoot.url)

        if firstURL:
            query = query.filter(PointRoot.url >= firstURL)

        pointRoots = query.fetch(11)
        if len(pointRoots) == 11:
            nextURL = pointRoots[-1].url
            pointRootsToReview = pointRoots[:10]
        else:
            pointRootsToReview = pointRoots

        for pointRoot in pointRootsToReview:
            f(pointRoot)

        if nextURL:
            t = Task(url=taskURL, params={'nexturl': nextURL})
            t.add(queue_name="notifications")
            logging.info('Requeing task to start at url %s ' % nextURL)
예제 #23
0
    def getArchivedComments(self):
        results = {'result': False}
        pointRootUrlsafe = self.request.get('rootKey')
        pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe)
        if pointRoot:
            try:
                template_values = {
                    'archivedComments': pointRoot.getArchivedComments()
                }
                html = self.template_render('archivedComments.html',
                                            template_values)
                results = {'result': True, 'html': html}
            except WhysaurusException as e:
                results['error'] = str(e)
        else:
            results['error'] = 'Unable to find point root'

        resultJSON = json.dumps(results)
        self.response.headers[
            "Content-Type"] = 'application/json; charset=utf-8'
        self.response.out.write(resultJSON)
예제 #24
0
 def getArchivedComments(self):
     results = {'result': False}
     pointRootUrlsafe = self.request.get('rootKey')
     pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe)
     if pointRoot:
         try: 
             template_values = {
                 'archivedComments': pointRoot.getArchivedComments()
             }
             html = self.template_render('archivedComments.html', template_values)
             results = {
                 'result': True,
                 'html': html
             }
         except WhysaurusException as e:
             results['error'] = str(e)
     else:
         results['error'] = 'Unable to find point root'
             
     resultJSON = json.dumps(results)
     self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
     self.response.out.write(resultJSON)
예제 #25
0
 def saveComment(self):
     results = {'result': False}
     text = self.request.get('commentText')
     pointRootUrlsafe = self.request.get('p')
     parentCommentUrlsafe = self.request.get('parentKey')
     
     user = self.current_user
     if user:
         try:
             pointRoot = PointRoot.getByUrlsafe(pointRootUrlsafe) 
             if pointRoot:               
                 comment = Comment.create(
                     text, user, pointRoot, 
                     parentCommentUrlsafe)
                 if comment:
                     pst_date = PST.convert(comment.date)
                     results = {
                                'result': True, 
                                'userName': user.name,
                                'userURL': user.url,
                                'avatar_url': user.avatar_url if hasattr(user, 'avatar_url') else '/static/img/icon_triceratops_black_47px.png',
                                'text': text,
                                'date': pst_date.strftime('%b. %d, %Y, %I:%M %p'),
                                'parentUrlsafe': parentCommentUrlsafe,
                                'myUrlSafe':comment.key.urlsafe(),
                                'level': comment.level
                                }
                     Point.addNotificationTask(pointRoot.key, user.key, 3, text)
                                
             else:
                 results['error'] = 'Unable to find the point to add this comment'
         except WhysaurusException as e:
             results['error'] = str(e)
     resultJSON = json.dumps(results)
     self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
     self.response.out.write(resultJSON)
    def post(self):      
        points = None
        listType = self.request.get('type')
        if listType == 'topAwards':
            points = PointRoot.getTopAwardPoints()
        elif listType == 'topViewed':
            points = PointRoot.getTopViewedPoints()
        elif listType == 'topRated':
            points = PointRoot.getTopRatedPoints()
        elif listType == 'editorsPics':
            points = PointRoot.getEditorsPicks()
        elif listType == 'topProjects':
            points = PointRoot.getTopRatedNodetype('Project')
        elif listType == 'topObjectives':
            points = PointRoot.getTopRatedNodetype('Objective')
        elif listType == 'topOrganizations':
            points = PointRoot.getTopRatedNodetype('Organization')

        template_values = {
            'points':points
        }
        path = os.path.join(constants.ROOT, 'templates/pointBoxList.html')
        self.response.headers.add_header('content-type', 'application/json', charset='utf-8')
        self.response.out.write(json.dumps(template.render(path, template_values)))
예제 #27
0
 def resolve_root(self, info):
     return PointRootModel.getByUrlsafe(self.rootURLsafe)
예제 #28
0
 def CalculateTopPoints(self):
     prs = PointRoot.query()
     for pr in prs.iter():
         pr.setTop()
예제 #29
0
 def resolve_newPoints(self, info, **args):
     return PointRootModel.getRecentCurrentPoints(info.context.current_user)
예제 #30
0
 def resolve_editorsPicks(self, info, **args):
     return PointRootModel.getEditorsPicks(info.context.current_user)
예제 #31
0
 def CalculateTopPoints(self):
     prs = PointRoot.query()
     for pr in prs.iter():
         pr.setTop()
    def checkNamespace(self, areaName): 
        bigMessage = []
        noErrors = 0
        pointCount = 0
        bigMessage.append("ooooooooooooooooooooooooooooooooooooooooooooooooooo")
        bigMessage.append("          NAMESPACE: " + areaName)
        bigMessage.append("ooooooooooooooooooooooooooooooooooooooooooooooooooo")
        
        namespace_manager.set_namespace(areaName) 
        
        # Take every point version
        query = Point.query()
        for point in query.iter():
            foundError = False
            checkingPointURL = point.key.urlsafe()
            # bigMessage.append("--------  Checking Point %s: <a href=\"%s%s\">%s</a> "\
            # % (point.title, constants.ADMIN_DATA_URL, checkingPointURL, point.key))
            for linkType in ["supporting", "counter"]:
                linkRoots, linkLastChange = point.getLinkCollections(linkType)
                
                if linkLastChange:
                    for pointKey in linkLastChange:
                        # Check based on the version array
                        # 1. Every linked point in the version array 
                        #    has to have a root in the root array
                        if not pointKey.parent() in linkRoots: 
                            bigMessage.append( \
                            "Point %s. Version %d: Missing corresponding root \
                            for %s point %s " % (point.url, point.version, linkType, str(pointKey)))
                            foundError = True
                        if point.current:
                            # 2. Every linked point in the link array of a current point 
                            #    should have backlinks in the root of the linked point
                            linkRoot = pointKey.parent().get()
                            backlinks, archiveBacklinks = linkRoot.getBacklinkCollections(linkType)
                            if not point.key.parent() in backlinks:
                                linkedPointURL = linkRoot.key.urlsafe()
                                bigMessage.append(
                                "Point %s. Version %d: Has %s link to \
                                 <a href=\"/point/%s\">%s</a> with no BACKLINK" \
                                 % (point.url, point.version, linkType, \
                                     linkRoot.url, linkRoot.url))
                                foundError = True
                
                    if len(linkLastChange) != len(linkRoots):
                        bigMessage.append(
                        "Point: <a href=\"/point/%s\">%s</a>. Version %d: \
                            Length mismatch in %s arrays. \
                            Version List has: %d. Root Array has: %d " % \
                            (point.url, point.title, point.version,
                             linkType, len(linkLastChange), \
                             len(linkRoots)))
                        foundError = True                
            if not foundError:
                noErrors = noErrors + 1
            pointCount = pointCount + 1
            
        bigMessage.append( "%d points checked. No errors detected in %d points" % (pointCount, noErrors))
        
        noErrors = 0
        rootCount = 0
        query = PointRoot.query()
        for pointRoot in query.iter():
            foundError = False
            linkVal = pointRoot.key.urlsafe()
            # bigMessage.append("--------  Checking Root %s: <a href=\"%s%s\">%s</a> "\
            # % (pointRoot.url, constants.ADMIN_DATA_URL, linkVal, pointRoot.key))
            curPoint = pointRoot.getCurrent()
            if not curPoint.current:
                bigMessage.append("Root <a href=\"/point/%s\">%s</a>: \
                Current point is not marked current" % \
                (pointRoot.url, curPoint.title))
                foundError = True

            pointQuery = Point.query(ancestor=pointRoot.key)
            points = pointQuery.fetch()
            curCount = 0
            curURLs = ""
            for point in points:
                if point.current:
                    curCount = curCount + 1
                    curURLs = curURLs + point.key.urlsafe()+ ","
            if curCount != 1:
                bigMessage.append("Root <a href=\"/point/%s\">%s</a>: \
                Found %d points marked current. URL keys: %s" % \
                (pointRoot.url, pointRoot.url, \
                 curCount, curURLs))
                foundError = True
                
            for linkType in ["supporting", "counter"]:
                linkPoints, archivedLinkPoints = \
                    pointRoot.getBacklinkCollections(linkType)
                for linkRootKey in linkPoints:
                    linkRoot = linkRootKey.get()
                    if not linkRoot:
                        bigMessage.append("Root <a href=\"/point/%s\">%s</a>: \
                        Not able to get %s backlink root by link root key %s" % \
                        ( pointRoot.url, pointRoot.url, \
                         linkType, linkRootKey))
                        foundError = True
                        continue
                    currentLinkPoint = linkRoot.getCurrent()
                    linkedPoints = currentLinkPoint.getLinkedPointsRootCollection(linkType)
                    if not pointRoot.key in linkedPoints:
                        versionKeyURL = currentLinkPoint.key.urlsafe()
                        bigMessage.append("Root <a href=\"/point/%s\">%s</a>: \
                             Have %s backlink to ' \
                            <a href=\"%s%s\">%s</a> but no link root." % \
                            ( pointRoot.url, pointRoot.url,\
                             linkType, currentLinkPoint.url, \
                             currentLinkPoint.title))
                        foundError = True
                           
            if not foundError:
                noErrors = noErrors + 1
            rootCount = rootCount + 1
            
        bigMessage.append( "%d roots checked. No errors detected in %d roots" % (rootCount, noErrors))        
        return bigMessage