Skip to content

Commit

Permalink
git subrepo pull uno
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "uno"
  merged:   "bbac335"
upstream:
  origin:   "https://github.com/prrvchr/uno.git"
  branch:   "main"
  commit:   "bbac335"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"
  • Loading branch information
prrvchr committed Nov 16, 2023
1 parent 8286f03 commit b9be5c1
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 38 deletions.
4 changes: 2 additions & 2 deletions uno/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/prrvchr/uno.git
branch = main
commit = 56abef3ff7d3ad9474d6b48cffb1019d0409fdbe
parent = 91bc3a620686cbf08f9b250eb30cb02572d8aa5c
commit = bbac33543c7f087ec486064776f93df42fd0ba37
parent = 8286f03f7f68732bcd9d140a5cd4261bc6524559
method = merge
cmdver = 0.4.3
4 changes: 2 additions & 2 deletions uno/lib/uno/card/card/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import traceback


class Books(unohelper.Base):
class Books(object):
def __init__(self, ctx, metadata, new):
self._ctx = ctx
print("Books.__init__() 1")
Expand Down Expand Up @@ -63,7 +63,7 @@ def _getBooks(self, metadata, new):
return books


class Book(unohelper.Base):
class Book(object):
def __init__(self, ctx, new, **kwargs):
self._ctx = ctx
self._new = new
Expand Down
2 changes: 1 addition & 1 deletion uno/lib/uno/card/card/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
import traceback


class DataBase(unohelper.Base):
class DataBase(object):
def __init__(self, ctx, url, user='', pwd=''):
self._ctx = ctx
self._statement = None
Expand Down
13 changes: 7 additions & 6 deletions uno/lib/uno/card/card/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@

from .book import Book

from ..cardtool import getSqlException

from ..dbtool import getDateTimeFromString

import traceback


class Provider(unohelper.Base):
class Provider(object):

@property
def DateTimeFormat(self):
Expand All @@ -53,10 +55,10 @@ def parseDateTime(self, timestamp):
def insertUser(self, database, request, scheme, server, name, pwd):
raise NotImplementedError

def initAddressbooks(self, database, user):
def initAddressbooks(self, source, database, user):
raise NotImplementedError

def initUserBooks(self, database, user, books):
def initUserBooks(self, source, database, user, books):
count = 0
modified = False
for uri, name, tag, token in books:
Expand All @@ -78,9 +80,8 @@ def initUserBooks(self, database, user, books):
count += 1
print("Provider.initUserBooks() 4")
if not count:
#TODO: Raise SqlException with correct message!
print("Provider.initUserBooks() 1 %s" % (books, ))
#raise getSqlException(self._ctx, self, 1004, 1108, 'initUserBooks', '%s has no support of CardDAV!' % user.Server)
cls, mtd = 'Provider', 'initUserBooks()'
raise getSqlException(self._ctx, source, 1006, 1109, cls, mtd, user.Name, user.Server)
if modified and self.supportAddressBook():
database.initAddressbooks(user)

Expand Down
17 changes: 9 additions & 8 deletions uno/lib/uno/card/card/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
import traceback


class User(unohelper.Base):
def __init__(self, ctx, database, provider, scheme, server, name, pwd=''):
class User(object):
def __init__(self, ctx, source, database, provider, scheme, server, name, pwd=''):
self._ctx = ctx
self._password = pwd
self._sessions = []
Expand All @@ -60,14 +60,15 @@ def __init__(self, ctx, database, provider, scheme, server, name, pwd=''):
if not new:
request = getRequest(ctx, server, name)
if request is None:
raise getSqlException(ctx, self, 1002, 1105, cls, mtd, name)
raise getSqlException(ctx, source, 1002, 1105, cls, mtd, name)
else:
if self._isOffLine(server):
raise getSqlException(ctx, self, 1004, 1108, cls, mtd, name)
raise getSqlException(ctx, source, 1004, 1108, cls, mtd, name)
request = getRequest(ctx, server, name)
if request is None:
raise getSqlException(ctx, self, 1002, 1105, cls, mtd, name)
self._metadata, books = self._getUserData(cls, mtd, database, provider, request, scheme, server, name, pwd)
raise getSqlException(ctx, source, 1002, 1105, cls, mtd, name)
self._metadata, books = self._getUserData(ctx, source, cls, mtd, database,
provider, request, scheme, server, name, pwd)
database.createUser(self.getSchema(), self.Id, name, '')
self.Request = request
self._books = Books(ctx, books, new)
Expand Down Expand Up @@ -134,10 +135,10 @@ def unquoteUrl(self, url):
def getBooks(self):
return self._books.getBooks()

def _getUserData(self, cls, mtd, database, provider, request, scheme, server, name, pwd):
def _getUserData(self, ctx, source, cls, mtd, database, provider, request, scheme, server, name, pwd):
data = provider.insertUser(database, request, scheme, server, name, pwd)
if data is None:
raise getSqlException(self._ctx, self, 1006, 1107, cls, mtd, name)
raise getSqlException(ctx, source, 1006, 1107, cls, mtd, name)
return data

def _isOffLine(self, server):
Expand Down
14 changes: 10 additions & 4 deletions uno/lib/uno/card/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
from .listener import EventListener
from .listener import TerminateListener

from .cardtool import getSqlException

from .unotool import getDesktop

import traceback


class DataSource(unohelper.Base):
class DataSource(object):
def __init__(self, ctx, database):
self._ctx = ctx
self._maps = {}
Expand Down Expand Up @@ -72,18 +74,22 @@ def closeConnection(self, connection):
print("DataSource.closeConnection() 2")

# Procedures called by Driver
def getConnection(self, scheme, server, account, password):
def getConnection(self, source, scheme, server, account, password):
uri = self._provider.getUserUri(server, account)
if uri in self._maps:
name = self._maps.get(uri)
user = self._users.get(name)
if not user.Request.isAuthorized():
cls, mtd = 'DataSource', 'getConnection()'
raise getSqlException(self._ctx, source, 1002, 1105, cls, mtd, name)
else:
user = User(self._ctx, self._database, self._provider, scheme, server, account, password)
user = User(self._ctx, source, self._database,
self._provider, scheme, server, account, password)
name = user.getName()
self._users[name] = user
self._maps[uri] = name
if user.isOnLine():
self._provider.initAddressbooks(self._database, user)
self._provider.initAddressbooks(source, self._database, user)
connection = self._database.getConnection(name, user.getPassword())
user.addSession(self._database.getSessionId(connection))
# User and/or AddressBooks has been initialized and the connection to the database is done...
Expand Down
8 changes: 2 additions & 6 deletions uno/lib/uno/card/replicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self, ctx, database, provider, users):
self._ctx = ctx
self._database = database
self._provider = provider
self._config = getConfiguration(ctx, g_identifier, False)
self._users = users
self._started = Event()
self._paused = Event()
Expand Down Expand Up @@ -80,13 +81,8 @@ def start(self):
def _canceled(self):
return False

def _canceled1(self):
return self._disposed.is_set() or not self._started.is_set()

def _getReplicateTimeout(self):
configuration = getConfiguration(self._ctx, g_identifier, False)
timeout = configuration.getByName('ReplicateTimeout')
return timeout
return self._config.getByName('ReplicateTimeout')

def _replicate(self):
print("replicator.run()1")
Expand Down
5 changes: 3 additions & 2 deletions uno/lib/uno/card/resource/Driver_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
1104=You must provide a valid Google account!

1105=The user: %s has abandoned the OAuth2 authorization wizard, the driver cannot continue without this authorization!!!
1106=Can't insert User: %s in DataBase
1106=Can't insert user: %s in DataBase
1107=User: %s does not exist at this Provider
1108=Can't retrieve User: %s from provider: network is OffLine!!!
1108=Can't retrieve user: %s from provider: network is OffLine!!!
1109=Can't retrieve AddressBook for user: %s, the server: % don't support AddressBook!!!

1 change: 1 addition & 0 deletions uno/lib/uno/card/resource/Driver_fr_FR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
1106=Impossible d'inserer l'utilisateur: %s dans la base de donn\u00e9es
1107=L'utilisateur: %s est inconnu chez ce fournisseur
1108=Impossible de retrouver l'utilisateur: %s chez le fournisseur: le r\u00e9seau est hors ligne!!!
1109=Impossible de r\u00e9cup\u00e9rer le carnet d'adresses pour l'utilisateur: %s, le serveur: % ne prend pas en charge les carnets d'adresses!!!

2 changes: 1 addition & 1 deletion uno/lib/uno/oauth2/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
g_extension = 'OAuth2OOo'
g_identifier = 'io.github.prrvchr.%s' % g_extension
g_service = '%s.OAuth2Service' % g_identifier
g_version = '1.2.1'
g_version = '1.2.2'

g_oauth2 = g_service

5 changes: 5 additions & 0 deletions uno/lib/uno/ucb/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ def getItem(self, user, itemid, rewrite=True):
item = getDataFromResult(result)
result.close()
select.close()
if item.get('IsFolder'):
infos = user.getCreatableContentsInfo(item.get('CanAddChild'))
else:
infos = ()
item['CreatableContentsInfo'] = infos
return item

def getChildren(self, username, itemid, properties, mode, scheme):
Expand Down
14 changes: 9 additions & 5 deletions uno/lib/uno/ucb/dbqueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,11 @@ def getSqlQuery(ctx, name, format=None):
SELECT I."ItemId" AS "Id", '' AS "Path",
'' AS "ParentId", I."ItemId" AS "ObjectId", I."Title",
I."Title" AS "TitleOnServer", I."DateCreated", I."DateModified",
I2."ContentType", I."MediaType", I."Size", I."Link", I."Trashed", TRUE AS "IsRoot",
I2."IsFolder", I2."IsLink", I2."IsDocument", C."CanAddChild", C."CanRename",
C."IsReadOnly", C."IsVersionable", I."ConnectionMode", '' AS "CasePreservingURL"
I2."ContentType", I."MediaType", I."Size", I."Link", I."Trashed",
TRUE AS "IsRoot", I2."IsFolder", I2."IsLink", I2."IsDocument", C."CanAddChild",
C."CanRename", C."IsReadOnly", C."IsVersionable", I."ConnectionMode",
'' AS "CasePreservingURL", FALSE AS "IsHidden", FALSE AS "IsVolume", FALSE AS "IsRemote",
FALSE AS "IsRemoveable", FALSE AS "IsFloppy", FALSE AS "IsCompactDisc"
FROM "Users" AS U
INNER JOIN "Items" AS I ON U."RootId"=I."ItemId"
INNER JOIN "Item" AS I2 ON I."ItemId"=I2."ItemId"
Expand All @@ -420,8 +422,10 @@ def getSqlQuery(ctx, name, format=None):
"GetTitle"(I."Title",T."Title",SWAP) AS "Title",
I."Title" AS "TitleOnServer", I."DateCreated", I."DateModified",
I2."ContentType", I."MediaType", I."Size", I."Link", I."Trashed",
FALSE AS "IsRoot", I2."IsFolder", I2."IsLink", I2."IsDocument", C."CanAddChild", C."CanRename",
C."IsReadOnly", C."IsVersionable", I."ConnectionMode", '' AS "CasePreservingURL"
FALSE AS "IsRoot", I2."IsFolder", I2."IsLink", I2."IsDocument", C."CanAddChild",
C."CanRename", C."IsReadOnly", C."IsVersionable", I."ConnectionMode",
'' AS "CasePreservingURL", FALSE AS "IsHidden", FALSE AS "IsVolume", FALSE AS "IsRemote",
FALSE AS "IsRemoveable", FALSE AS "IsFloppy", FALSE AS "IsCompactDisc"
FROM "Items" AS I
INNER JOIN "Item" AS I2 ON I."ItemId"=I2."ItemId"
INNER JOIN "Capabilities" AS C ON I."ItemId"=C."ItemId"
Expand Down
2 changes: 1 addition & 1 deletion uno/lib/uno/ucb/ucp/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def removePropertiesChangeListener(self, names, listener):

# XContentCreator
def queryCreatableContentsInfo(self):
return self._user.getCreatableContentsInfo(self.CanAddChild)
return self.MetaData.get('CreatableContentsInfo')
def createNewContent(self, info):
path = self._user.getContentPath(self.Path, self.Title, self.IsRoot)
return self._user.createNewContent(self.Id, self.Link, path, self._authority, info.Type)
Expand Down
9 changes: 9 additions & 0 deletions uno/lib/uno/ucb/ucp/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,22 @@ def _getNewContent(self, parentid, link, path, contentype):
data['Trashed'] = False
data['IsRoot'] = False
data['IsFolder'] = isfolder
data['IsLink'] = False
data['IsDocument'] = isdocument
data['CanAddChild'] = isfolder
data['CanRename'] = True
data['IsReadOnly'] = False
data['IsVersionable'] = isdocument
data['ConnectionMode'] = True
data['BaseURI'] = path
data['CasePreservingURL'] = ''
data['IsHidden'] = False
data['IsVolume'] = False
data['IsRemote'] = False
data['IsRemoveable'] = False
data['IsFloppy'] = False
data['IsCompactDisc'] = False
data['CreatableContentsInfo'] = self.getCreatableContentsInfo(isfolder)
return data

def _getNewIdentifier(self):
Expand Down

0 comments on commit b9be5c1

Please sign in to comment.