示例#1
0
    def update(self, trackingId=None):
        """ Look up tracker and make it generate tracking HTML snippet """
        mobile_properties = getCachedMobileProperties(self.context, self.request)

        if not trackingId:
            trackingId = mobile_properties.tracking_id.strip()

        trackerName = mobile_properties.tracker_name.strip()

        # TODO: Migration hack - may be removed after 1.0 has been released
        debug = getattr(mobile_properties, "tracker_debug", None)

        #print "Tracking:" + str(trackerName)

        if trackingId == "":
            # Assume empty input string equals to not set
            trackingId = None

        if trackerName == "":
            trackerName = None

        if trackerName and trackingId:
            # Look up the tracker
            tracker = self.getTracker(trackerName)
            self.trackingCode = tracker.track(trackingId, debug)

        else:
            self.trackingCode = ""
示例#2
0
 def __init__(self, context, request):
     self.context = context
     self.request = request
     try:
         self.mobile_properties = getCachedMobileProperties(
             context, self.request)
     except AttributeError:
         self.mobile_properties = {}