473,724 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strange result with json-server & zope

i'm using maildrophost to sendmail and wrote a script for it

when the script is called directly from web request , a letter
geneated with right things

but when the script is called from json-rpc, the letter generated
include a mess.
see the file with this letter

[the script]
body_html = container.mime_ mail(body_html= body_html)
container.MailH ost.send(messag eText=body_html , mto=to_email,
mfrom=from_emai l, subject=subject , encode=None)

[mime_mail is a dtml-method]
<dtml-mime type="text/html" charset="utf8" encode="quoted-printable"
disposition="in line">
<dtml-var body_html missing="this is the body of mail goes">
</dtml-mime>

[enviroment]
Zope Version
(Zope 2.9.4-final, python 2.4.3, linux2)
Python Version
2.4.3 (#1, Sep 11 2006, 19:52:33) [GCC 3.4.6 20060404 (Red Hat
3.4.6-3)]
System Platform
linux2

strangely at another server, everythin runs smoothly
[enviroment]
Zope Version
(Zope 2.9.2-, python 2.4.3, linux2)
Python Version
2.4.3 (#1, Mar 31 2006, 17:42:57) [GCC 3.4.4 20050721 (Red Hat
3.4.4-2)]

[called directly from web request ]
##To:as******** @gmail.com
##From:we****** *@126.com
Message-Id: <20************ ***********@zto oo.ztooo.com>
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="127.0 .0.1.500.5494.1 158303670.500.4 "
Subject: You probably forgot your password for Ztooo.com
To: as********@gmai l.com
From: we*******@126.c om
Date: Fri, 15 Sep 2006 15:01:10 -0500
--127.0.0.1.500.5 494.1158303670. 500.4
Content-Type: text/html;
charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv=3D"Conten t-Type" content=3D"text/html;
charset=3Dutf-8">
<title>You probably forgot your password for
Ztooo.com!=E6=8 2=A8=E5=8F=AF=
=E8=83=BD=E9=81 =97=E5=BF=98=E4 =BA=86=E6=91=98 =E7=BD=91=E7=9A =84=E5=AF=86=E7 =
=A0=81!</title>
</head>
<body>
<h3>=E6=82=A8=E 5=8F=AF=E8=83=B D=E9=81=97=E5=B F=98=E4=BA=86=E 6=91=98=E7=BD=
=91=E7=9A=84=E5 =AF=86=E7=A0=81 </h3>
<hr />
<p>&nbsp;&nbsp; &nbsp;&nbsp;=E6 =82=A8=E7=9A=84 =E5=AF=86=E7=A0 =81=E6=98=AF
<f=
ont
color=3D"blue"> </font>
=EF=BC=8C=E4=BD =BF=E7=94=A8=E6 =AD=A4=E9=82=AE =E7=
=AE=B1=E5=90=8D =E4=BD=9C=E4=B8 =BA=E7=94=A8=E6 =88=B7=E5=90=8D =E5=92=8C=E6=AD =
=A4=E5=AF=86=E7 =A0=81=E7=99=BB =E5=BD=95=EF=BC =8C=E6=88=96=E8 =80=85=E7=82=B9 =
=E5=87=BB=E4=B8 =8B=E9=9D=A2=E7 =9A=84=E6=8C=89 =E9=92=AE=E7=99 =BB=E5=BD=95=EF =
=BC=9A</p>
<div>
<form method=3D"post" action=3D"http://web3.com/index.htm"
target=3D"_blan k" enctype=3D"mult ipart/form-data">
<input type=3D"hidden" name=3D"__ac_na me" id=3D"__ac_name "
size=3D"12" value=3D"as**** ****@gmail.com" >
<input type=3D"hidden" name=3D"__ac_pa ssword" size=3D"12"
value=3D"">
=20
&nbsp;&nbsp;&nb sp;&nbsp;<input type=3D"submit"
value=3D"=E7=82 =B9=E5=87=BB=
=E6=AD=A4=E5=A4 =84=E7=99=BB=E5 =BD=95">
=20
</form>
</div>
<p>&nbsp;&nbsp; &nbsp;&nbsp;=E7 =99=BB=E5=BD=95 =E5=90=8E=E6=82 =A8=E5=8F=AF=E4 =
=BB=A5=E4=BF=AE =E6=94=B9=E6=82 =A8=E7=9A=84=E5 =AF=86=E7=A0=81 =E5=92=8C=E8=AE =
=BE=E7=BD=AE=E6 =82=A8=E5=96=9C =E6=AC=A2=E7=9A =84=E7=AC=94=E5 =90=8D=E3=80=82 =
</p>
<br />
<h3>You probably forgot your password for Ztooo.com!</h3>
<hr />
<p>&nbsp;&nbsp; &nbsp;&nbsp;You r password is <font
color=3D"blue"> </font, Use the mailboxname as username and this
passw=
ord to login , or click the button below:</p>
<div>
<form method=3D"post" action=3D"http://web3.com/index.htm"
target=3D"_blan k" enctype=3D"mult ipart/form-data">
<input type=3D"hidden" name=3D"__ac_na me" id=3D"__ac_name "
size=3D"12" value=3D"as**** ****@gmail.com" >
<input type=3D"hidden" name=3D"__ac_pa ssword" size=3D"12"
value=3D"">
&nbsp;&nbsp;&nb sp;&nbsp;<input type=3D"submit" value=3D"Press here
to =
login">
=20
</form>
</div>
<p>&nbsp;&nbsp; &nbsp;&nbsp; You could change your password and set your
favo=
rite pseudonym after that.</p>
</body>
</html>
--127.0.0.1.500.5 494.1158303670. 500.4--

[called from json-rpc]
##To:as******** @gmail.com
##From:we****** *@126.com
Message-Id: <20************ ***********@zto oo.ztooo.com>
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="127.0 .0.1.500.5494.1 158303673.002.5 "
Subject: You probably forgot your password for Ztooo.com
To: as********@gmai l.com
From: we*******@126.c om
Date: Fri, 15 Sep 2006 15:01:13 -0500
--127.0.0.1.500.5 494.1158303673. 002.5
Content-Type: text/html;
charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

< ! D O C T Y P E H T M L P U B L I C " - / / W 3 C / / D T D H
T M=
L 4 . 0 1 T r a n s i t i o n a l / / E N "
" h t t p : / / w w w . w 3 . o r g / T R / h t m l 4 / l o o s e . d
t d =
" >
< h t m l >
< h e a d >
< m e t a h t t p - e q u i v =3D " C o n t e n t - T y p e " c o
n t =
e n t =3D " t e x t / h t m l ; c h a r s e t =3D u t f - 8 " >
< t i t l e Y o u p r o b a b l y f o r g o t y o u r p a s
s w =
o r d f o r Z t o o o . c o m !
=A8`=EFS=FD=80W =90=D8_=86NXdQ= 7F=84v=C6=
[x! < / t i t l e >
< / h e a d >
< b o d y >
< h 3 =A8`=EFS=FD=80W =90=D8_=86NXdQ= 7F=84v=C6[x< / h 3 >
< h r / >
< p & n b s p ; & n b s p ; & n b s p ; & n b s p ; =A8`=84v=C6[x/f
< =
f o n t
c o l o r =3D " b l u e " < / f o n t >
=FF=7FO(udk=AE= 90=B1{=

T\O:N(u7b
T=8CTdk=C6[x{vU_ =FFb=80=B9p=F BQ Nb=97=84v c=AE=94{vU_=FF < /=
p >
< d i v >
< f o r m m e t h o d =3D " p o s t " a c t i o n =3D " h t t
p : =
/ / w e b 3 . c o m / i n d e x . h t m "
t a r g e t =3D " _ b l a n k " e n c t y p e =3D "
m u =
l t i p a r t / f o r m - d a t a " >
< i n p u t t y p e =3D " h i d d e n " n a m e =3D " _ _
a c =
_ n a m e " i d =3D " _ _ a c _ n a m e "
s i z e =3D " 1 2 " v a l u e =3D " a s t e r
o c =
e a n @ g m a i l . c o m " >
< i n p u t t y p e =3D " h i d d e n " n a m e =3D " _ _
a c =
_ p a s s w o r d " s i z e =3D " 1 2 "
v a l u e =3D " " >

& n b s p ; & n b s p ; & n b s p ; & n b s p ; < i n p u t t y p e
=3D =
" s u b m i t " v a l u e =3D " =B9p=FBQdkY{vU _" >

< / f o r m >
< / d i v >
< p & n b s p ; & n b s p ; & n b s p ; & n b s p ;
{vU_T=A8`=EFS= E5N=
=EEO9e=A8`=84v= C6[x=8CT=BE=8Bn=7 F=A8`=9CU"k=84v {
T0< / p >
< b r / >
< h 3 Y o u p r o b a b l y f o r g o t y o u r p a s s w o
r d =
f o r Z t o o o . c o m ! < / h 3 >
< h r / >
< p & n b s p ; & n b s p ; & n b s p ; & n b s p ; Y o u r p a s
s w =
o r d i s < f o n t
c o l o r =3D " b l u e " < / f o n t , U s e t h e
m =
a i l b o x n a m e a s u s e r n a m e a n d t h i s p a s s
w o=
r d t o l o g i n , o r c l i c k t h e b u t t o n b
e l =
o w : < / p >
< d i v >
< f o r m m e t h o d =3D " p o s t " a c t i o n =3D " h t t
p : =
/ / w e b 3 . c o m / i n d e x . h t m "
t a r g e t =3D " _ b l a n k " e n c t y p e =3D "
m u =
l t i p a r t / f o r m - d a t a " >
< i n p u t t y p e =3D " h i d d e n " n a m e =3D " _ _
a c =
_ n a m e " i d =3D " _ _ a c _ n a m e "
s i z e =3D " 1 2 " v a l u e =3D " a s t e r
o c =
e a n @ g m a i l . c o m " >
< i n p u t t y p e =3D " h i d d e n " n a m e =3D " _ _
a c =
_ p a s s w o r d " s i z e =3D " 1 2 "
v a l u e =3D " " >
& n b s p ; & n b s p ; & n b s p ; & n b s p ; < i n p u t
t =
y p e =3D " s u b m i t " v a l u e =3D " P r e s s h e r e t o
l o=
g i n " >

< / f o r m >
< / d i v >
< p & n b s p ; & n b s p ; & n b s p ; & n b s p ; Y o u c o u l
d =
c h a n g e y o u r p a s s w o r d a n d s e t y o u r f a
v o=
r i t e p s e u d o n y m a f t e r t h a t . < / p >
< / b o d y >
< / h t m l


--127.0.0.1.500.5 494.1158303673. 002.5--

Sep 16 '06 #1
3 2449
At Saturday 16/9/2006 07:28, astarocean wrote:
>[the script]
body_html = container.mime_ mail(body_html= body_html)
container.Mail Host.send(messa geText=body_htm l, mto=to_email,
mfrom=from_ema il, subject=subject , encode=None)

[mime_mail is a dtml-method]
<dtml-mime type="text/html" charset="utf8" encode="quoted-printable"
disposition="i nline">
<dtml-var body_html missing="this is the body of mail goes">
</dtml-mime>
"utf8" is not the right spelling, should be UTF-8
>[called from json-rpc]
Content-Type: text/html;
charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

< ! D O C T Y P E H T M L P U B L I C " - / / W 3 C / / D T D H
T M=
L 4 . 0 1 T r a n s i t i o n a l / / E N "
" h t t p : / / w w w . w 3 . o r g / T R / h t m l 4 / l o o s e . d
t d =
" >
But this is not UTF-8; looks like UTF-16 with 0x00 converted to 0x20
(space). I'd look at where the body comes from, or ask on the Zope
list for the right way to use dtml-mime.

Anyway, why are you using dtml-mime and such? Using the email package
is easier and a lot more powerful.
Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Sep 16 '06 #2
At Saturday 16/9/2006 08:40, asterocean wrote:
>>But this is not UTF-8; looks like UTF-16 with 0x00 converted to 0x20
(space). I'd look at where the body comes from, or ask on the Zope
list for the right way to use dtml-mime.

i've try with UTF-8 , error remains . when the script is called
directly from http request , it went well. so this should not be the
problem. the real problem is when it is called from a json-rpc, the
error happened
Try to look at what you *get* as the body from xmlrpc, if it comes
wrong, will go wrong to the email.
>>Anyway, why are you using dtml-mime and such? Using the email package
is easier and a lot more powerful.
i'm using zope & jsonserver & maildrop to develop this part , so the
main problem how to send mail with json-rpc structure.
You can use the email package from inside Zope; an external method will do.

Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Sep 16 '06 #3
error finnaly been eliminated.
after install placelesstransl ationservice product, everything back to
normal.
but i don't know why.

the program runs well under a server with zope2.9.1 ,
for i got another server and i wanna do a global update ,so a new zope
version 2.9.4 and all other new version were installed and the program
was exported from old server and imported in new server . but i didn't
install placelesstransl ationservice product, it seems nofair with this
program.that's why this error happen.

really strange turn out , i guess there's something wrong with zexp
mechanic , for it seemed program exported and imported are binary code
not source code with objects like scripts, so some stein code remains.

thank you, Gabrial.
Gabriel Genellina wrote:
At Saturday 16/9/2006 08:40, asterocean wrote:
>But this is not UTF-8; looks like UTF-16 with 0x00 converted to 0x20
(space). I'd look at where the body comes from, or ask on the Zope
list for the right way to use dtml-mime.
i've try with UTF-8 , error remains . when the script is called
directly from http request , it went well. so this should not be the
problem. the real problem is when it is called from a json-rpc, the
error happened

Try to look at what you *get* as the body from xmlrpc, if it comes
wrong, will go wrong to the email.
>Anyway, why are you using dtml-mime and such? Using the email package
is easier and a lot more powerful.
i'm using zope & jsonserver & maildrop to develop this part , so the
main problem how to send mail with json-rpc structure.

You can use the email package from inside Zope; an external method will do.

Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
Sep 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1807
by: George Jempty | last post by:
In my journal anyway: "JSON: Javascript Unusable by the Client" http://slashdot.org/~scriptify/journal/103074
16
2702
by: G Matthew J | last post by:
http://htmatters.net/htm/1/2005/07/evaling-JSON.cfm This is more or less in response to Mr Crockford's admonition a few months ago, "fork if you must". Ironically, although in that usenet post he calls what I am suggesting "brittle", his own Javascript JSON parser is not valid JSON, but rather conforms to my proposed variation on JSON!! With an identifier prepended to the front of the JSON block, and function literals as values: see...
8
10412
by: Douglas Crockford | last post by:
There is a new version of JSON.parse in JavaScript. It is vastly faster and smaller than the previous version. It uses a single call to eval to do the conversion, guarded by a single regexp test to assure that it is safe. JSON.parse = function (text) { return (/^(\s|]|"(\\|)*"|-?\d+(\.\d*)?(?\d+)?|true|false|null)+$/.test(text)) && eval('(' + text + ')'); };
10
2999
by: Frank Millman | last post by:
Hi all I am writing a multi-user accounting/business application, which uses sockets to communicate between server and client. The server contains all the business logic. It has no direct knowledge of the client. I have devised a simple message format to exchange information between the two. At first, I used XML as a message format. Then I read the article that recommended not using XML for Python-to-Python, so I changed it to a
3
10178
by: Adam | last post by:
I'm trying to retrieve some values from a json object, but instead it's giving me the property name. For example: var json = { "glossary": { "title": "example glossary" } }; console.log(json); alert(json.glossary.title); for (var x in json) { console.log(x); alert(x.title); } This will show me the json object in the console with glossary and title underneath it. When the alert for json.glossary.title fires, it
2
3324
by: ChrisO | last post by:
I've been pretty infatuated with JSON for some time now since "discovering" it a while back. (It's been there all along in JavaScript, but it was just never "noticed" or used by most until recently -- or maybe I should just speak for myself.) The fact that JSON is more elegant goes without saying, yet I can't seem to find a way to use JSON the way I *really* want to use it: to create objects that can be instantated into multiple...
23
3209
by: dhtmlkitchen | last post by:
JSON We all know what it is. In ECMAScript 4, there's a JSON proposal: Object.prototype.toJSONString String.prototype.parseJSON The current proposal, String.prototype.parseJSON, returns an object.
7
3049
by: Logos | last post by:
I am using PHP with the JSON extension function json_decode. I have a JSON with a member named "1" (ie) { "1":"somedata" } Trying to access this via the -operator doesn't work, nor does . Putting the JSON into a foreach loop DOES access the member: foreach($json as $key=>$value) {
9
10874
by: Jon Paal [MSMD] | last post by:
using json like ( {"Records": , "RecordCount":"1" } ) and jquery like: $.ajax({ .... success: function(json, status) {
6
2827
by: Lasse Reichstein Nielsen | last post by:
Max <adsl@tiscali.itwrites: Not really. It shows that a particularly naïve implementation of a conversion from XML to JSON doesn't work well. What if the conversion of <e> some
0
8868
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8741
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9243
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6689
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5996
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4771
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.