is the way of code is correct or not to get the logged username in plone

1 message Options
Embed this post
Permalink
sreenath167 () is the way of code is correct or not to get the logged username in plone
Reply Threaded More More options
Print post
Permalink
 @memoize
    def _data(self):
        """ """
        context = aq_inner(self.context)
        catalog = getToolByName(context, 'portal_catalog')
        path = context.getPhysicalPath()
        mt =  getToolByName(self, 'portal_membership')
        if  mt.isAnonymousUser():
            return ''
        else:
            member = mt.getAuthenticatedMember()
            #path += '/'+'MyMicroSites'+'/'+ member.getUserName()+'Home'
            path += '/'+'MyMicroSites'+'/'+ 'sreenath'+'Home'
            #path += '/'+  member.getUserName() + 'MyContacts' + '/' +  member.getUserName() + 'Contacts' + '/advcntsearch'
            path += '/'+ 'sreenath' + 'MyContacts' + '/' + 'sreenath' + 'Contacts' + '/advcntsearch'

        if path == '':
            return ''

        return path