Example #1
0
 def __str__(self):
     utf8 = etree.tostring(self.xmlelement(),
                           encoding="utf-8",
                           xml_declaration=True,
                           pretty_print=True)
     if isPython3():
         return str(utf8, 'utf-8')
     return utf8
Example #2
0
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

from datetime import datetime
from caldav.lib.python_utilities import isPython3
if isPython3():
    from urllib import parse
    from urllib.parse import urlparse
else:
    from urlparse import urlparse as parse
    from urlparse import urlparse
import logging
import threading
import time
from nose.tools import assert_equal, assert_not_equal, assert_raises

from .conf import caldav_servers, proxy, proxy_noport
from .proxy import ProxyHandler, NonThreadingHTTPServer

from caldav.davclient import DAVClient
from caldav.objects import Principal, Calendar, Event, DAVObject, CalendarSet, FreeBusy
from caldav.lib.url import URL
from caldav.lib import url
from caldav.lib import error
from caldav.lib.namespace import ns
from caldav.elements import dav, cdav
from caldav.lib.python_utilities import to_local, to_str

log = logging.getLogger("caldav")

Example #3
0
File: url.py Project: beralt/caldav
 def __str__(self):
     if isPython3():
         return self.__unicode__()
     return self.__unicode__().encode('utf-8')
Example #4
0
File: url.py Project: beralt/caldav
def uc2utf8(input):
    ## argh!  this feels wrong, but seems to be needed.
    if not isPython3() and type(input) == unicode:
        return input.encode('utf-8')
    else:
        return input
Example #5
0
on BaseHTTPServer, and behaves as an HTTP proxy.  The CONNECT
method is also implemented experimentally, but has not been
tested yet.

Any help will be greatly appreciated.		SUZUKI Hisao

2009/11/23 - Modified by Mitko Haralanov
             * Added very simple FTP file retrieval
             * Added custom logging methods
             * Added code to make this a standalone application
"""

__version__ = "0.3.1"

from caldav.lib.python_utilities import isPython3
if isPython3():
    from urllib import parse
    from urllib.parse import urlparse, urlunparse
    from http.server import BaseHTTPRequestHandler, HTTPServer
    from socketserver import ThreadingMixIn
else:
    from urlparse import urlparse as parse
    from urlparse import urlparse, urlunparse
    from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
    from SocketServer import ThreadingMixIn

import select
import socket

import logging
import logging.handlers
Example #6
0
 def __str__(self):
     utf8 = etree.tostring(self.xmlelement(), encoding="utf-8",
                           xml_declaration=True, pretty_print=True)
     if isPython3():
         return str(utf8, 'utf-8')
     return utf8
Example #7
0
File: url.py Project: glibin/caldav
 def __str__(self):
     if isPython3():
         return self.__unicode__()
     return self.__unicode__().encode('utf-8')
Example #8
0
File: url.py Project: glibin/caldav
def uc2utf8(input):
    ## argh!  this feels wrong, but seems to be needed.
    if not isPython3() and type(input) == unicode:
        return input.encode('utf-8')
    else:
        return input