issue: Permissions in odfpy

2009-05-19 Thread shruti surve
hey,
i am using odfpy and  generating spreadsheet in open office..but nobody
should modify the file..so can anybody tell me how can we give permissions
(read only) to spreadsheet in odfpy??..i have change the properties of my
normal open office spreadsheet file and made it read only..n also extracted
it..but in conteny.xml also i am not finding any property which can be used
in odfpy...so please give me some solution..


regards
shruti surve
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: issue: Permissions in odfpy

2009-05-19 Thread Krishnakant
Through the python code,
chmod 400 filename.ods
happy hacking.
Krishnakant.

On Tue, 2009-05-19 at 12:21 +0530, shruti surve wrote:
 hey,
 i am using odfpy and  generating spreadsheet in open office..but
 nobody should modify the file..so can anybody tell me how can we give
 permissions (read only) to spreadsheet in odfpy??..i have change the
 properties of my normal open office spreadsheet file and made it read
 only..n also extracted it..but in conteny.xml also i am not finding
 any property which can be used in odfpy...so please give me some
 solution..
 
 
 regards
 shruti surve

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: issue: Permissions in odfpy

2009-05-19 Thread Philipp Hagemeister
Hi Shruti,

your message is kind of hard to read. Please note the following:

· Do not put useless junk(issue) in title.
· Multiple exclamation marks convey a sure sign of a diseased mind,
especially syntactically interesting constructions such as ??..
· You didn't purchase your keyboard in August 2001, did you? (
http://ars.userfriendly.org/cartoons/?id=20010820 )
· It's probably just me, but so please give me some solution sounds
really rude. Why not any ideas?, thanks in advance or just nothing?
Would you answer an email that ended like this? Please keep in mind, you
are not paying us, and we're trying to help you just because we want
happy python users (or trying to offset us being evil at times).
· Everyone mistpyes, and I'd be throwing mountains in my glass house if
I complained about grammar, but please show at least some effort.

That being said, this might help:

import odf.opendocument

doc = odf.opendocument.load('in.ods')
# You may want to use another way to select the sheet,
# this selects just the first one
sheet = doc.spreadsheet.childNodes[0]
sheet.setAttrNS(
'urn:oasis:names:tc:opendocument:xmlns:table:1.0',
'protected',
'true')
doc.save('out.ods')

Regards,

Philipp

shruti surve wrote:
 hey,
 i am using odfpy and  generating spreadsheet in open office..but nobody
 should modify the file..so can anybody tell me how can we give permissions
 (read only) to spreadsheet in odfpy??..i have change the properties of my
 normal open office spreadsheet file and made it read only..n also
extracted
 it..but in conteny.xml also i am not finding any property which can be
used
 in odfpy...so please give me some solution..


 regards
 shruti surve




signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list