Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: How do I convert &$self.text(dbcol[docdb].pretty_name); into something meaningful in python

Reply
Thread Tools

RE: How do I convert &$self.text(dbcol[docdb].pretty_name); into something meaningful in python

 
 
Khalid Sheikh
Guest
Posts: n/a
 
      07-18-2003
Hi,

I have been tasked to Integrate Inktomi Search (now Verity of course)
with our website. I am fairly new to Python. The way the search
engine is setup is that it has embedded python in a html document.
After looking at the html code for a day or so, I was able to pin
point the place where I need to make a change but I am having a hard
time.

I am assuming

&$self.text(dbcol[docdb].pretty_name);

prints something in HTML but I am trying to figure out it's equivalent
in Python. I am assuming this is a string and I need to check it's
value against another string say 'XXY' if it is equal then go ahead
and print that value otherwise skip to the next item in the
list/array.


This is what I had before and it worked

<!--$
first = 1
for docdb in docdbs:
if not dbcol.has_key(docdb): continue
if first: first = 0; --> <!--$
else: -->, <!--$
-->Test< &$self.text(dbcol[docdb].pretty_name); >Test<!--$
if not first: -->

when run this prints

Test< XXY >Test, Test< ABCD >Test

I want it to print only when the string is equal to XXY. otherwise
skip to the next string. This is the edited code that I have so far.


<!--$
first = 1
for docdb in docdbs:
if not dbcol.has_key(docdb): continue
if first: first = 0; --> <!--$
else: -->, <!--$
# my code
if dbcol[docdb] == <spider.Collection 'pc'> --> <!--$
# end of my code
-->Test< &$self.text(dbcol[docdb].pretty_name); >Test<!--$
if not first: -->


I get the following error when I run the program.

exceptions.SyntaxError: invalid syntax (line 86)
Line 86
if dbcol[docdb] == <spider.Collection 'pc'> wlines.append(u' ');

Any help would be greatly appreciated.

Khalid J. Sheikh
Software Engineer
Silvaco International
http://www.silvaco.com
(40 654-4352

 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      07-19-2003
Khalid Sheikh fed this fish to the penguins on Friday 18 July 2003
09:38 am:

>
> exceptions.SyntaxError: invalid syntax (line 86)
> Line 86
> if dbcol[docdb] == <spider.Collection 'pc'> wlines.append(u' ');
>

The "<xxxxxx>" is NOT valid Python syntax. You have a line that, in
words, is similar to:

if data-item-value is equal to is less than collection-item literal is
greater than another-data-item

I'm surprised any of it parses, considering how often you drop in and
out of those script comments.


<!--$
first = 1
for docdb in docdbs:
if dbcol.has_key(docdb):
if first:
first = 0
else:
if dbcol[docdb] == <spider.Collection 'pc'>:
# I still don't understand how the <....> works, unless it gets
# parsed FIRST, and the result is valid Python...
# OH, BTW -- you were missing the : at the end of the IF line
-->Test< &$...; >Test<!--$
if not first:
# more Python code...

-->

--
> ================================================== ============ <
> http://www.velocityreviews.com/forums/(E-Mail Removed) | Wulfraed Dennis Lee Bieber KD6MOG <
> (E-Mail Removed) | Bestiaria Support Staff <
> ================================================== ============ <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Convert binary string to something meaningful?? supercooper Python 1 06-13-2007 02:28 PM
OT: Meaningful employment for mcngp members Network Guru MCSE 5 08-11-2004 05:01 AM
Meaningful error messages from a web service Joshua Ellul ASP .Net 0 02-15-2004 12:29 AM
any good books for studying VHDL with meaningful examples? walala VHDL 1 08-11-2003 05:00 PM



Advertisments