python

5 Differences: Moving from XML Sitemap module to Google's Sitemap Generators

For a large site that I maintain, we recently disabled the XML Sitemap module (we're using the 1.x branch) and switched to the Google Sitemap Generators tool (the Python one). We have noticed a few unsurprising things, and a few very surprising things.

We identified five big differences (all positive) that we have seen since moving to the Google Sitemap Generators Python tool.

OS X Security Warning on Email Attachments: Getting rid of them

A colleague of mine recently pointed out that when you unzip an archive of scripts received as an email attachment, every time you open a file, you get a warning like this:

“csvimport.inc.php” is a script application which was attached to a mail message. Are you sure you want to open it?

When you have dozens of scripts to look at, clicking through this warning each time is irritating, to say the least. A little examination of the xattr flags on these files, though, revealed the problem:

$ python 
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xattr
>>> xattr.listxattr('config.inc.php')
(u'com.apple.quarantine',)
>>> 

There is a flag on such files called 'com.apple.quarantine'. This flag needs to be cleared.

Originally, I was going to write a script to do this, but a quick google obviated that need. Mark Liyanage has done this already. He shows two different ways to clear the flag.

Python on Mac: Using the xattr functions to get extended attributes

Have you ever noticed that sometimes when you copy OS X files from your Mac to, say, a Linux or Windows server, you get a bunch of files that begin with ._? Those are metadata files. They store extended attributes for other files. Why don't they appear on Mac OS X? Because on OS X, extended attributes are stored in the file system itself, not in auxiliary hidden files. In this article, I am going to cover how you can use Python on your Mac to access the extended attributes.

Syndicate content