Hi, 

First of all thanks a lot for your reply. "search.findall" is not working. here 
is my complete small program.

 

def getAcl(request, pg):
    pged = PageEditor(request, pg)
    pagetext = pged.get_raw_body()
    search=re.compile("^#acl InternationalGroup.*\n", re.M).search(pagetext)
    if search:
        ret=search.group()
    else:
        ret='not defined'
    return ret


def execute(macro, args):

    html="<p><b>ACL List For International Group:</b><br>"
    all={}
    pages = macro.request.rootpage.getPageList()
    for pagename in pages:
        if Page(macro.request,pagename).isStandardPage():
            all[Page(macro.request, 
pagename).link_to(macro.request)]=getAcl(macro.request, pagename)

    html+="<table>"
    all1=sorted(all.items())
    for pg, ac in all1:
        if ac != "not defined":
            html+="<tr><td>%s</td>" % pg
            html+="<td>%s</td></tr>" % ac
    html+="</table>"
    return macro.formatter.rawHTML(html)



 
Now i explain this.

I have some wiki pages(or you can say documents). 

This python program is giving me list of all those pages, where i have written 
"#acl InternationalGroup:read" line in the pages and these pages may have also 
"CatInternational" line in the page. 

 



Now i want to search all those pages, where i have NOT written "#acl 
InternationalGroup:read" But  i have written only "CatInternational" in the 
page text.

 

I dont know how can i find only those pages where i have written only 
"CatInternational" line in the page. 

 

I shall be veryyyyyyyyyyyyyy thankful to you really for help. 

 

Best Regards, 

Waqas

 

 





Date: Fri, 25 Sep 2009 15:39:27 -0600
Subject: Re: [Tutor] Help required
From: vinces1...@gmail.com
To: waqas...@hotmail.com
CC: python-l...@python.org; tutor@python.org





On Fri, Sep 25, 2009 at 1:56 PM, waqas ahmad <waqas...@hotmail.com> wrote:





 Hi, 
 
I dont know it is the right place to post this question. I need help to change 
one search code line . can you help me please.
 
here is my search method code:
 
search=re.compile("^#acl InternationalGroup.*\n", re.M).search(pagetext)
    if search:
        ret=search.group()
    else:
        ret='not defined'
    return ret

 
here i am searching for "#acl InternationalGroup" in the pageText and when it 
true is then give me search group.
 
 
I want to change this for following requirement:
 
I want to search  for "#acl InternationalGroup" and  "CatInternational" for 
both in the pageText.
when "#acl InternationalGroup" is not there but only "CatInternational" is 
there. then return me search group.
I shall be thankful to you for any help.
 
Best Regards, 
Waqas





What can you do with the new Windows Live? Find out
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


i think this is what you are looking for:



search=re.compile("(#acl\sInternationalGroup|CatInternational).*\n", 
re.M).search(pagetext)
if search:
    ret=search.findall()
else:
    ret='not defined'
return ret

                                          
_________________________________________________________________
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to