Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

        def findtimezone(config):
    # check the environment for the zone value
    zone = os.environ.get("TZ")

    logging.debug('Zone from env is %s.' % zone)

    # some desktops don't set the env var but /etc/timezone should
    # have the value regardless
    if None != zone:
        logging.debug('Returning env var value.')
        return zone

    # this is common on many *nix variatns
    logging.debug('Checking /etc/timezone')
    if os.path.exists('/etc/timezone'):
        zone_file = open('/etc/timezone')

        try:
            zone = zone_file.read()
        finally:
            zone_file.close()
        zone = zone.replace("\n", "")
        return zone

    # this is specific to OS X
    logging.debug('Checking /etc/localtime')
    if os.path.exists('/etc/localtime'):
        zone = os.path.realpath('/etc/localtime')
        (zone, city) = os.path.split(zone);
        (zone, continent) = os.path.split(zone);
        zone = os.path.join(continent, city)
        return zone

    logging.debug('Checking .flashbake')
    if 'timezone' in config.__dict__:
        zone = config.timezone
        return zone

    logging.warn('Could not get TZ from env var, /etc/timezone, or .flashbake.')
    zone = None

    return zone
        


src/f/l/flashbake-0.27/src/flashbake/plugins/weather.py   flashbake(Download)
 
from flashbake.plugins import AbstractMessagePlugin
from flashbake.plugins.timezone import findtimezone
from urllib2 import HTTPError, URLError
import logging
            set, will try to use the system time zone to identify a city. """
        if config.location_location == None and self.city == None:
            zone = findtimezone(config)
            if zone == None:
                city = None

src/f/l/flashbake-HEAD/src/flashbake/plugins/weather.py   flashbake(Download)
 
from flashbake.plugins import AbstractMessagePlugin
from flashbake.plugins.timezone import findtimezone
from flashbake.plugins import timezone
from urllib2 import HTTPError, URLError
            set, will try to use the system time zone to identify a city. """
        if config.location_location == None and self.city == None:
            zone = findtimezone(config)
            if zone == None:
                city = None