I built a UPS using a an EBay sourced boost converter and lithium ion charge controller. I used a lithium ion battery I salvaged out of an old bluetooth speaker. I mounted it all to a sheet of aluminum. Total cost: $3
I used a 3.3v signal from the power supply to tell the pi if it lost AC power. I modified my software to E-Mail me and shutdown the pi if the battery got too low.
In testing the UPS, I uncovered that at a certain point, about half charge on the battery, the voltage dips and the boost converter drops-out triggering a reset on the pi. I only end up getting around 20 minutes of battery life with the 750 mAh battery, which is adequate for most power loss events.