On 11/02/2012 1:04 p.m., Chris Fulton wrote:
> Hello,
>
> I am new here. I need my .po files to have certain permissions, specifically 
> 664 and not 600. Because savestore() uses tempfile.mkstemp and shutil.move I 
> will always get 600 regardless of my umask.
>
> Here is the fix:
>
> --- local_apps/pootle_store/fields.py   2012-02-10 15:59:03.698008000 -0800
> +++ local_apps/pootle_store/fields.py.new       2012-02-10 15:58:41.760740000 
> -0800
> @@ -200,7 +200,8 @@
>           tmpfile, tmpfilename = tempfile.mkstemp(suffix=self.filename)
>           os.close(tmpfile)
>           self.store.savefile(tmpfilename)
> -        shutil.move(tmpfilename, self.realpath)
> +        shutil.copyfile(tmpfilename, self.realpath)
> +        os.remove(tmpfilename)
>           self._touch_store_cache()
>
>       def save(self, name, content, save=True):
>
>
> If you like it, please adopt it, or I would be happy to commit it to svn.


FYI: copy is not very good practice. Move is used because the file may 
have changed between when the copy started and when it finished.

The correct fix in these situations is usually to alter the file 
permissions before or after the move. Best of all would be to create it 
with correct permissions in the first place.

AYJ

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to