示例#1
0
文件: vcard.py 项目: 5monkeys/vobject
                     'ORG':       (0, None, None),
                     'PHOTO':     (0, None, None),
                     'CATEGORIES':(0, None, None)
                    }
                    
    @classmethod
    def generateImplicitParameters(cls, obj):
        """Create PRODID, VERSION, and VTIMEZONEs if needed.
        
        VTIMEZONEs will need to exist whenever TZID parameters exist or when
        datetimes with tzinfo exist.
        
        """
        if not hasattr(obj, 'version'):
            obj.add(ContentLine('VERSION', [], cls.versionString))
registerBehavior(VCard3_0, default=True)

class FN(VCardTextBehavior):
    name = "FN"
    description = 'Formatted name'
registerBehavior(FN)

class Label(VCardTextBehavior):
    name = "Label"
    description = 'Formatted address'
registerBehavior(Label)

wacky_apple_photo_serialize = True
REALLY_LARGE = 1E50

class Photo(VCardTextBehavior):
示例#2
0
                   # TODO: If lacking dtend & duration?
               
                if dtend:
                    human = dtend
                    # TODO: Human readable part could be smarter, excluding repeated data
                    if type(dtend) == date:
                        human = dtend - timedelta(days=1)
                        
                    out('- <abbr class="dtend", title="%s">%s</abbr>\r\n' % 
                     (dtend.strftime(machine), human.strftime(timeformat)))    

            # LOCATION    
            location = event.getChildValue("location")
            if location:
                out('at <span class="location">' + location + '</span>' + CRLF)
        
            description = event.getChildValue("description")
            if description:
                out('<div class="description">' + description + '</div>' + CRLF)
            
            if url:
                level -= 1
                out('</a>' + CRLF)
            
            level -= 1                
            out('</span>' + CRLF) # close vevent

        return buf or outbuf.getvalue()
    
registerBehavior(HCalendar)
示例#3
0
        'CATEGORIES': (0, None, None)
    }

    @classmethod
    def generateImplicitParameters(cls, obj):
        """Create PRODID, VERSION, and VTIMEZONEs if needed.
        
        VTIMEZONEs will need to exist whenever TZID parameters exist or when
        datetimes with tzinfo exist.
        
        """
        if not hasattr(obj, 'version'):
            obj.add(ContentLine('VERSION', [], cls.versionString))


registerBehavior(VCard3_0, default=True)


class FN(VCardTextBehavior):
    name = "FN"
    description = 'Formatted name'


registerBehavior(FN)


class Label(VCardTextBehavior):
    name = "Label"
    description = 'Formatted address'

示例#4
0
                   # TODO: If lacking dtend & duration?
               
                if dtend:
                    human = dtend
                    # TODO: Human readable part could be smarter, excluding repeated data
                    if type(dtend) == date:
                        human = dtend - timedelta(days=1)
                        
                    out('- <abbr class="dtend", title="%s">%s</abbr>\r\n' % 
                     (dtend.strftime(machine), human.strftime(timeformat)))    

            # LOCATION    
            location = event.getChildValue("location")
            if location:
                out('at <span class="location">' + location + '</span>' + CRLF)
        
            description = event.getChildValue("description")
            if description:
                out('<div class="description">' + description + '</div>' + CRLF)
            
            if url:
                level -= 1
                out('</a>' + CRLF)
            
            level -= 1                
            out('</span>' + CRLF) # close vevent

        return buf or outbuf.getvalue()
    
registerBehavior(HCalendar)